<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Gluon Package &mdash; Web2Py v1.64.4 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.64.4',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="top" title="Web2Py v1.64.4 documentation" href="../index.html" />
    <link rel="up" title="Web2Py Modules" href="../modules.html" />
    <link rel="next" title="Compat Documentation" href="gluon.compat.html" />
    <link rel="prev" title="Web2Py Modules" href="../modules.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="gluon.compat.html" title="Compat Documentation"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="../modules.html" title="Web2Py Modules"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">Web2Py v1.64.4 documentation</a> &raquo;</li>
          <li><a href="../modules.html" accesskey="U">Web2Py Modules</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="gluon-package">
<h1>Gluon Package<a class="headerlink" href="#gluon-package" title="Permalink to this headline">¶</a></h1>
<p>This page contains the Gluon Package documentation.</p>
<div class="section" id="subpackages">
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline">¶</a></h2>
<ul>
<li class="toctree-l1"><a class="reference external" href="gluon.compat.html">Compat Documentation</a><ul>
<li class="toctree-l2"><a class="reference external" href="gluon.compat.html#the-uuid-module">The <tt class="docutils literal"><span class="pre">uuid</span></tt> Module</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference external" href="gluon.contrib.html">Contrib Documentation</a><ul>
<li class="toctree-l2"><a class="reference external" href="gluon.contrib.html#subpackages">Subpackages</a><ul>
<li class="toctree-l3"><a class="reference external" href="gluon.contrib.pyrtf.html">Pyrtf Documentation</a><ul>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.pyrtf.html#module-gluon.contrib.pyrtf.Elements">The <tt class="docutils literal"><span class="pre">Elements</span></tt> Module</a></li>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.pyrtf.html#module-gluon.contrib.pyrtf.Renderer">The <tt class="docutils literal"><span class="pre">Renderer</span></tt> Module</a></li>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.pyrtf.html#module-gluon.contrib.pyrtf.PropertySets">The <tt class="docutils literal"><span class="pre">PropertySets</span></tt> Module</a></li>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.pyrtf.html#module-gluon.contrib.pyrtf">The <tt class="docutils literal"><span class="pre">pyrtf</span></tt> Package</a></li>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.pyrtf.html#module-gluon.contrib.pyrtf.Constants">The <tt class="docutils literal"><span class="pre">Constants</span></tt> Module</a></li>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.pyrtf.html#module-gluon.contrib.pyrtf.Styles">The <tt class="docutils literal"><span class="pre">Styles</span></tt> Module</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference external" href="gluon.contrib.gateways.html">Gateways Documentation</a><ul>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.gateways.html#module-gluon.contrib.gateways.fcgi">The <tt class="docutils literal"><span class="pre">fcgi</span></tt> Module</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference external" href="gluon.contrib.markdown.html">Markdown Documentation</a><ul>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.markdown.html#module-gluon.contrib.markdown">The <tt class="docutils literal"><span class="pre">markdown</span></tt> Package</a></li>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.markdown.html#module-gluon.contrib.markdown.markdown2">The <tt class="docutils literal"><span class="pre">markdown2</span></tt> Module</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference external" href="gluon.contrib.memcache.html">Memcache Documentation</a><ul>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.memcache.html#module-gluon.contrib.memcache.memcache">The <tt class="docutils literal"><span class="pre">memcache</span></tt> Module</a><ul>
<li class="toctree-l5"><a class="reference external" href="gluon.contrib.memcache.html#overview">Overview</a></li>
<li class="toctree-l5"><a class="reference external" href="gluon.contrib.memcache.html#usage-summary">Usage summary</a></li>
<li class="toctree-l5"><a class="reference external" href="gluon.contrib.memcache.html#detailed-documentation">Detailed Documentation</a></li>
</ul>
</li>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.memcache.html#module-gluon.contrib.memcache">The <tt class="docutils literal"><span class="pre">memcache</span></tt> Package</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference external" href="gluon.contrib.simplejson.html">Simplejson Documentation</a><ul>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.simplejson.html#module-gluon.contrib.simplejson.encoder">The <tt class="docutils literal"><span class="pre">encoder</span></tt> Module</a></li>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.simplejson.html#module-gluon.contrib.simplejson">The <tt class="docutils literal"><span class="pre">simplejson</span></tt> Package</a></li>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.simplejson.html#module-gluon.contrib.simplejson.scanner">The <tt class="docutils literal"><span class="pre">scanner</span></tt> Module</a></li>
<li class="toctree-l4"><a class="reference external" href="gluon.contrib.simplejson.html#module-gluon.contrib.simplejson.decoder">The <tt class="docutils literal"><span class="pre">decoder</span></tt> Module</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference external" href="gluon.contrib.html#module-gluon.contrib.feedparser">The <tt class="docutils literal"><span class="pre">feedparser</span></tt> Module</a></li>
<li class="toctree-l2"><a class="reference external" href="gluon.contrib.html#module-gluon.contrib.memdb">The <tt class="docutils literal"><span class="pre">memdb</span></tt> Module</a></li>
<li class="toctree-l2"><a class="reference external" href="gluon.contrib.html#module-gluon.contrib.rss2">The <tt class="docutils literal"><span class="pre">rss2</span></tt> Module</a></li>
<li class="toctree-l2"><a class="reference external" href="gluon.contrib.html#module-gluon.contrib.wsgihooks">The <tt class="docutils literal"><span class="pre">wsgihooks</span></tt> Module</a></li>
<li class="toctree-l2"><a class="reference external" href="gluon.contrib.html#the-taskbar-widget-module">The <tt class="docutils literal"><span class="pre">taskbar_widget</span></tt> Module</a></li>
<li class="toctree-l2"><a class="reference external" href="gluon.contrib.html#module-gluon.contrib.cron">The <tt class="docutils literal"><span class="pre">cron</span></tt> Module</a></li>
<li class="toctree-l2"><a class="reference external" href="gluon.contrib.html#the-gae-memcache-module">The <tt class="docutils literal"><span class="pre">gae_memcache</span></tt> Module</a></li>
<li class="toctree-l2"><a class="reference external" href="gluon.contrib.html#the-gql-module">The <tt class="docutils literal"><span class="pre">gql</span></tt> Module</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="module-gluon.validators">
<h2>The <tt class="xref docutils literal"><span class="pre">validators</span></tt> Module<a class="headerlink" href="#module-gluon.validators" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<p>Thanks to ga2arch for help with IS_IN_DB and IS_NOT_IN_DB on GAE</p>
<dl class="class">
<dt id="gluon.validators.IS_ALPHANUMERIC">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_ALPHANUMERIC</tt><big>(</big><em>error_message='must be alphanumeric!'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_ALPHANUMERIC" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.validators.IS_MATCH" class="reference internal" href="#gluon.validators.IS_MATCH"><tt class="xref docutils literal"><span class="pre">gluon.validators.IS_MATCH</span></tt></a></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_ALPHANUMERIC</span><span class="p">())</span>
</pre></div>
</div>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_DATE">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_DATE</tt><big>(</big><em>format='%Y-%m-%d'</em>, <em>error_message='must be YYYY-MM-DD!'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_DATE" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_DATE</span><span class="p">())</span>
</pre></div>
</div>
<p>date has to be in the ISO8960 format YYYY-MM-DD</p>
<dl class="method">
<dt id="gluon.validators.IS_DATE.formatter">
<tt class="descname">formatter</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_DATE.formatter" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_DATETIME">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_DATETIME</tt><big>(</big><em>format='%Y-%m-%d %H:%M:%S'</em>, <em>error_message='must be YYYY-MM-DD HH:MM:SS!'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_DATETIME" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_DATETIME</span><span class="p">())</span>
</pre></div>
</div>
<p>datetime has to be in the ISO8960 format YYYY-MM-DD hh:mm:ss</p>
<dl class="method">
<dt id="gluon.validators.IS_DATETIME.formatter">
<tt class="descname">formatter</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_DATETIME.formatter" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_EMAIL">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_EMAIL</tt><big>(</big><em>banned=None</em>, <em>forced=None</em>, <em>error_message='invalid email!'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_EMAIL" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>Checks if field&#8217;s value is a valid email address. Can be set to disallow
or force addresses from certain domain(s).</p>
<p>Email regex taken from <a class="reference external" href="http://regexlib.com/REDetails.aspx?regexp_id=541">http://regexlib.com/REDetails.aspx?regexp_id=541</a></p>
<p>Arguments:</p>
<p>banned: regex text for disallowed address domains
forced: regex text for required address domains</p>
<p>Both arguments can also be custom objects with a match(value) method.</p>
<p>Examples:</p>
<p>Check for valid email address:
INPUT(_type=&#8217;text&#8217;, _name=&#8217;name&#8217;, requires=IS_EMAIL())</p>
<p>Check for valid email address that can&#8217;t be from a .com domain:
INPUT(_type=&#8217;text&#8217;, _name=&#8217;name&#8217;, requires=IS_EMAIL(banned=&#8217;^.*.com(<a href="#id1"><span class="problematic" id="id2">|</span></a>..*)$&#8217;))</p>
<div class="system-message" id="id1">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">/Users/mdipierro/web2py/gluon/validators.py:docstring of gluon.validators.IS_EMAIL</tt>, line 20); <em><a href="#id2">backlink</a></em></p>
Inline substitution_reference start-string without end-string.</div>
<p>Check for valid email address that must be from a .edu domain:
INPUT(_type=&#8217;text&#8217;, _name=&#8217;name&#8217;, requires=IS_EMAIL(forced=&#8217;^.*.edu(<a href="#id3"><span class="problematic" id="id4">|</span></a>..*)$&#8217;))</p>
<div class="system-message" id="id3">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">/Users/mdipierro/web2py/gluon/validators.py:docstring of gluon.validators.IS_EMAIL</tt>, line 23); <em><a href="#id4">backlink</a></em></p>
Inline substitution_reference start-string without end-string.</div>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_EXPR">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_EXPR</tt><big>(</big><em>expression</em>, <em>error_message='invalid expression!'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_EXPR" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span>
    <span class="n">requires</span><span class="o">=</span><span class="n">IS_EXPR</span><span class="p">(</span><span class="s">&#39;5 &lt; int(value) &lt; 10&#39;</span><span class="p">))</span>
</pre></div>
</div>
<p>the argument of IS_EXPR must be python condition:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">IS_EXPR</span><span class="p">(</span><span class="s">&#39;int(value) &lt; 2&#39;</span><span class="p">)(</span><span class="s">&#39;1&#39;</span><span class="p">)</span>
<span class="go">(&#39;1&#39;, None)</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">IS_EXPR</span><span class="p">(</span><span class="s">&#39;int(value) &lt; 2&#39;</span><span class="p">)(</span><span class="s">&#39;2&#39;</span><span class="p">)</span>
<span class="go">(&#39;2&#39;, &#39;invalid expression!&#39;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_UPLOAD_FILENAME">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_UPLOAD_FILENAME</tt><big>(</big><em>filename=None</em>, <em>extension=None</em>, <em>lastdot=True</em>, <em>case=1</em>, <em>error_message='invalid filename or extension!'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_UPLOAD_FILENAME" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>Checks if name and extension of file uploaded through file input matches
given criteria.</p>
<p>Does <em>not</em> ensure the file type in any way. Returns validation failure
if no data was uploaded.</p>
<p>Arguments:</p>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">/Users/mdipierro/web2py/gluon/validators.py:docstring of gluon.validators.IS_UPLOAD_FILENAME</tt>, line 11)</p>
Literal block expected; none found.</div>
<p>filename: filename (before dot) regex
extension: extension (after dot) regex
lastdot: which dot should be used as a filename / extension separator:</p>
<div class="system-message">
<p class="system-message-title">System Message: ERROR/3 (<tt class="docutils">&lt;autodoc&gt;</tt>, line 0)</p>
Unexpected indentation.</div>
<blockquote>
True means last dot, eg. file.png -&gt; file / png
False means first dot, eg. file.tar.gz -&gt; file / tar.gz</blockquote>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">/Users/mdipierro/web2py/gluon/validators.py:docstring of gluon.validators.IS_UPLOAD_FILENAME</tt>, line 16)</p>
Block quote ends without a blank line; unexpected unindent.</div>
<dl class="docutils">
<dt>case: 0 - keep the case, 1 - transform the string into lowercase (default),</dt>
<dd>2 - transform the string into uppercase</dd>
</dl>
<p>If there is no dot present, extension checks will be done against empty
string and filename checks against whole value.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c">#Check if file has a pdf extension (case insensitive):</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;file&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_UPLOAD_FILENAME</span><span class="p">(</span><span class="n">extension</span><span class="o">=</span><span class="s">&#39;pdf&#39;</span><span class="p">))</span>

<span class="c">#Check if file has a tar.gz extension and name starting with backup:</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;file&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_UPLOAD_FILENAME</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">&#39;backup.*&#39;</span><span class="p">,</span> <span class="n">extension</span><span class="o">=</span><span class="s">&#39;tar.gz&#39;</span><span class="p">,</span> <span class="n">lastdot</span><span class="o">=</span><span class="bp">False</span><span class="p">))</span>

<span class="c">#Check if file has no extension and name matching README (case sensitive):</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;file&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_UPLOAD_FILENAME</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">&#39;^README$&#39;</span><span class="p">,</span> <span class="n">extension</span><span class="o">=</span><span class="s">&#39;^$&#39;</span><span class="p">,</span> <span class="n">case</span><span class="o">=</span><span class="mf">0</span><span class="p">))</span>
</pre></div>
</div>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_FLOAT_IN_RANGE">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_FLOAT_IN_RANGE</tt><big>(</big><em>minimum</em>, <em>maximum</em>, <em>error_message='too small or too large!'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_FLOAT_IN_RANGE" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_FLOAT_IN_RANGE</span><span class="p">(</span><span class="mf">0</span><span class="p">,</span> <span class="mf">10</span><span class="p">))</span>
</pre></div>
</div>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_IMAGE">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_IMAGE</tt><big>(</big><em>extensions=('bmp'</em>, <em>'gif'</em>, <em>'jpeg'</em>, <em>'png')</em>, <em>maxsize=(10000</em>, <em>10000)</em>, <em>minsize=(0</em>, <em>0)</em>, <em>error_message='invalid image!'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_IMAGE" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>Checks if file uploaded through file input was saved in one of selected
image formats and has dimensions (width and height) within given boundaries.</p>
<p>Does <em>not</em> check for maximum file size (use IS_LENGTH for that). Returns
validation failure if no data was uploaded.</p>
<p>Supported file formats: BMP, GIF, JPEG, PNG.</p>
<p>Code parts taken from <a class="reference external" href="http://mail.python.org/pipermail/python-list/2007-June/617126.html">http://mail.python.org/pipermail/python-list/2007-June/617126.html</a></p>
<p>Arguments:</p>
<p>extensions: iterable containing allowed <em>lowercase</em> image file extensions
(&#8216;jpg&#8217; extension of uploaded file counts as &#8216;jpeg&#8217;)
maxsize: iterable containing maximum width and height of the image
minsize: iterable containing minimum width and height of the image</p>
<p>Use (-1, -1) as minsize to pass image size check.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c">#Check if uploaded file is in any of supported image formats:</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;file&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_IMAGE</span><span class="p">())</span>

<span class="c">#Check if uploaded file is either JPEG or PNG:</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;file&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_IMAGE</span><span class="p">(</span><span class="n">extensions</span><span class="o">=</span><span class="p">(</span><span class="s">&#39;jpeg&#39;</span><span class="p">,</span> <span class="s">&#39;png&#39;</span><span class="p">)))</span>

<span class="c">#Check if uploade file is PNG with maximum size of 200x200 pixels:</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;file&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_IMAGE</span><span class="p">(</span><span class="n">extensions</span><span class="o">=</span><span class="p">(</span><span class="s">&#39;png&#39;</span><span class="p">),</span> <span class="n">maxsize</span><span class="o">=</span><span class="p">(</span><span class="mf">200</span><span class="p">,</span> <span class="mf">200</span><span class="p">)))</span>
</pre></div>
</div>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_INT_IN_RANGE">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_INT_IN_RANGE</tt><big>(</big><em>minimum</em>, <em>maximum</em>, <em>error_message='too small or too large!'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_INT_IN_RANGE" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_INT_IN_RANGE</span><span class="p">(</span><span class="mf">0</span><span class="p">,</span> <span class="mf">10</span><span class="p">))</span>
</pre></div>
</div>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_IN_SET">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_IN_SET</tt><big>(</big><em>theset</em>, <em>labels=None</em>, <em>error_message='value not allowed!'</em>, <em>multiple=False</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_IN_SET" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_IN_SET</span><span class="p">([</span><span class="s">&#39;max&#39;</span><span class="p">,</span> <span class="s">&#39;john&#39;</span><span class="p">]))</span>
</pre></div>
</div>
<p>the argument of IS_IN_SET must be a list or set</p>
<dl class="method">
<dt id="gluon.validators.IS_IN_SET.options">
<tt class="descname">options</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.validators.IS_IN_SET.options" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_IPV4">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_IPV4</tt><big>(</big><em>minip='0.0.0.0'</em>, <em>maxip='255.255.255.255'</em>, <em>error_message='invalid IPv4 address!'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_IPV4" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>Checks if field&#8217;s value is an IP version 4 address in decimal form. Can
be set to force adresses from certain range.</p>
<p>IPv4 regex taken from: <a class="reference external" href="http://regexlib.com/REDetails.aspx?regexp_id=1411">http://regexlib.com/REDetails.aspx?regexp_id=1411</a></p>
<p>Arguments:</p>
<dl class="docutils">
<dt>minip: lowest allowed address; accepts:</dt>
<dd>str, eg. 192.168.0.1
iterable of numbers, eg. [192, 168, 0, 1]
int, eg. 3232235521</dd>
</dl>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">/Users/mdipierro/web2py/gluon/validators.py:docstring of gluon.validators.IS_IPV4</tt>, line 14)</p>
Definition list ends without a blank line; unexpected unindent.</div>
<p>maxip: highest allowed address; same as above</p>
<p>All three example values are equal, since addresses are converted to
integers for inclusion check with following function:</p>
<p>number = 16777216 * IP[0] + 65536 * IP[1] + 256 * IP[2] + IP[3]</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c">#Check for valid IPv4 address:</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span><span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span><span class="n">requires</span><span class="o">=</span><span class="n">IS_IPV4</span><span class="p">())</span>

<span class="c">#Check for valid private network IPv4 address:</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span><span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span><span class="n">requires</span><span class="o">=</span><span class="n">IS_IPV4</span><span class="p">(</span><span class="n">minip</span><span class="o">=</span><span class="s">&#39;192.168.0.1&#39;</span><span class="p">,</span> <span class="n">maxip</span><span class="o">=</span><span class="s">&#39;192.168.255.255&#39;</span><span class="p">))</span>
</pre></div>
</div>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_LENGTH">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_LENGTH</tt><big>(</big><em>maxsize=255</em>, <em>minsize=0</em>, <em>error_message='invalid length!'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_LENGTH" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>Checks if length of field&#8217;s value fits between given boundaries. Works
for both text and file inputs.</p>
<p>Arguments:</p>
<p>maxsize: maximum allowed length / size
minsize: minimum allowed length / size</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c">#Check if text string is shorter than 33 characters:</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_LENGTH</span><span class="p">(</span><span class="mf">32</span><span class="p">))</span>

<span class="c">#Check if password string is longer than 5 characters:</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;password&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_LENGTH</span><span class="p">(</span><span class="n">minsize</span><span class="o">=</span><span class="mf">6</span><span class="p">))</span>

<span class="c">#Check if uploaded file has size between 1KB and 1MB:</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;file&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_LENGTH</span><span class="p">(</span><span class="mf">1048576</span><span class="p">,</span> <span class="mf">1024</span><span class="p">))</span>
</pre></div>
</div>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_LIST_OF">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_LIST_OF</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_LIST_OF" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_LOWER">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_LOWER</tt><a class="headerlink" href="#gluon.validators.IS_LOWER" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_MATCH">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_MATCH</tt><big>(</big><em>expression</em>, <em>error_message='invalid expression!'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_MATCH" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_MATCH</span><span class="p">(</span><span class="s">&#39;.+&#39;</span><span class="p">))</span>
</pre></div>
</div>
<p>the argument of IS_MATCH is a regular expression:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">IS_MATCH</span><span class="p">(</span><span class="s">&#39;.+&#39;</span><span class="p">)(</span><span class="s">&#39;hello&#39;</span><span class="p">)</span>
<span class="go">(&#39;hello&#39;, None)</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">IS_MATCH</span><span class="p">(</span><span class="s">&#39;.+&#39;</span><span class="p">)(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
<span class="go">(&#39;&#39;, &#39;invalid expression!&#39;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_NOT_EMPTY">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_NOT_EMPTY</tt><big>(</big><em>error_message='cannot be empty!'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_NOT_EMPTY" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_NOT_EMPTY</span><span class="p">())</span>
</pre></div>
</div>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_TIME">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_TIME</tt><big>(</big><em>error_message='must be HH:MM:SS!'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_TIME" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_TIME</span><span class="p">())</span>
</pre></div>
</div>
<p>understands the follwing formats
hh:mm:ss [am/pm]
hh:mm [am/pm]
hh [am/pm]</p>
<p>[am/pm] is options, &#8216;:&#8217; can be replaced by any other non-digit</p>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_URL">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_URL</tt><big>(</big><em>error_message='invalid url!'</em>, <em>mode='http'</em>, <em>allowed_schemes=None</em>, <em>prepend_scheme='http'</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_URL" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<dl class="docutils">
<dt>Rejects a URL string if any of the following is true:</dt>
<dd><ul class="first last simple">
<li>The string is empty or None</li>
<li>The string uses characters that are not allowed in a URL</li>
<li>The string breaks any of the HTTP syntactic rules</li>
<li>The URL scheme specified (if one is specified) is not &#8216;http&#8217; or &#8216;https&#8217;</li>
<li>The top-level domain (if a host name is specified) does not exist</li>
</ul>
</dd>
</dl>
<p>(These rules are based on RFC 2616: <a class="reference external" href="http://www.faqs.org/rfcs/rfc2616.html">http://www.faqs.org/rfcs/rfc2616.html</a>)</p>
<p>This function only checks the URL&#8217;s syntax. It does not check that the URL points to a real document,
for example, or that it otherwise makes sense semantically. This function does automatically prepend
&#8216;<a class="reference external" href="http://">http://</a>&#8216; in front of a URL in the case of an abbreviated URL (e.g. &#8216;google.ca&#8217;).</p>
<p>If the parameter mode=&#8217;generic&#8217; is used, then this function&#8217;s behaviour changes. It then rejects a URL
string if any of the following is true:</p>
<div class="system-message">
<p class="system-message-title">System Message: ERROR/3 (<tt class="docutils">/Users/mdipierro/web2py/gluon/validators.py:docstring of gluon.validators.IS_ALPHANUMERIC</tt>, line 3)</p>
Unexpected indentation.</div>
<blockquote>
<ul class="simple">
<li>The string is empty or None</li>
<li>The string uses characters that are not allowed in a URL</li>
<li>The URL scheme specified (if one is specified) is not valid</li>
</ul>
</blockquote>
<p>(These rules are based on RFC 2396: <a class="reference external" href="http://www.faqs.org/rfcs/rfc2396.html">http://www.faqs.org/rfcs/rfc2396.html</a>)</p>
<p>The list of allowed schemes is customizable with the allowed_schemes parameter. If you exclude None from
the list, then abbreviated URLs (lacking a scheme such as &#8216;http&#8217;) will be rejected.</p>
<p>The default prepended scheme is customizable with the prepend_scheme parameter. If you set prepend_scheme
to None then prepending will be disabled. URLs that require prepending to parse will still be accepted,
but the return value will not be modified.</p>
<p>IS_URL is compatible with the Internationalized Domain Name (IDN) standard specified in RFC 3490
(<a class="reference external" href="http://tools.ietf.org/html/rfc3490">http://tools.ietf.org/html/rfc3490</a>). As a result, URLs can be regular strings or unicode strings.
If the URL&#8217;s domain component (e.g. google.ca) contains non-US-ASCII letters, then the domain will
be converted into Punycode (defined in RFC 3492, <a class="reference external" href="http://tools.ietf.org/html/rfc3492">http://tools.ietf.org/html/rfc3492</a>). IS_URL goes a
bit beyond the standards, and allows non-US-ASCII characters to be present in the path
and query components of the URL as well. These non-US-ASCII characters will be escaped using the
standard &#8216;%20&#8217; type syntax. e.g. the unicode character with hex code 0x4e86 will become &#8216;%4e%86&#8217;</p>
<p>Code Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_URL</span><span class="p">())</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_URL</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="s">&#39;generic&#39;</span><span class="p">))</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span>
    <span class="n">requires</span><span class="o">=</span><span class="n">IS_URL</span><span class="p">(</span><span class="n">allowed_schemes</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;https&#39;</span><span class="p">]))</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span>
    <span class="n">requires</span><span class="o">=</span><span class="n">IS_URL</span><span class="p">(</span><span class="n">prepend_scheme</span><span class="o">=</span><span class="s">&#39;https&#39;</span><span class="p">))</span>
<span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span>
    <span class="n">requires</span><span class="o">=</span><span class="n">IS_URL</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="s">&#39;generic&#39;</span><span class="p">,</span> <span class="n">allowed_schemes</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;ftps&#39;</span><span class="p">,</span> <span class="s">&#39;https&#39;</span><span class="p">],</span>
        <span class="n">prepend_scheme</span><span class="o">=</span><span class="s">&#39;https&#39;</span><span class="p">))</span>
</pre></div>
</div>
<p>&#64;author: Jonathan Benn</p>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.CLEANUP">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">CLEANUP</tt><a class="headerlink" href="#gluon.validators.CLEANUP" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">CLEANUP</span><span class="p">())</span>
</pre></div>
</div>
<p>removes special characters on validation</p>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.CRYPT">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">CRYPT</tt><big>(</big><em>key=None</em>, <em>digest_alg='md5'</em><big>)</big><a class="headerlink" href="#gluon.validators.CRYPT" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">CRYPT</span><span class="p">())</span>
</pre></div>
</div>
<p>encodes the value on validation with a digest</p>
</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_IN_DB">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_IN_DB</tt><big>(</big><em>dbset</em>, <em>field</em>, <em>label=None</em>, <em>error_message='value not in database!'</em>, <em>orderby=None</em>, <em>cache=None</em>, <em>multiple=False</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_IN_DB" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_IN_DB</span><span class="p">(</span><span class="n">db</span><span class="p">,</span> <span class="n">db</span><span class="o">.</span><span class="n">table</span><span class="p">))</span>
</pre></div>
</div>
<p>used for reference fields, rendered as a dropbox</p>
<dl class="method">
<dt id="gluon.validators.IS_IN_DB.build_set">
<tt class="descname">build_set</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.validators.IS_IN_DB.build_set" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.validators.IS_IN_DB.options">
<tt class="descname">options</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.validators.IS_IN_DB.options" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_NOT_IN_DB">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_NOT_IN_DB</tt><big>(</big><em>dbset</em>, <em>field</em>, <em>error_message='value already in database!'</em>, <em>allowed_override=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#gluon.validators.IS_NOT_IN_DB" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_NOT_IN_DB</span><span class="p">(</span><span class="n">db</span><span class="p">,</span> <span class="n">db</span><span class="o">.</span><span class="n">table</span><span class="p">))</span>
</pre></div>
</div>
<p>makes the field unique</p>
<dl class="method">
<dt id="gluon.validators.IS_NOT_IN_DB.set_self_id">
<tt class="descname">set_self_id</tt><big>(</big><em>id</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_NOT_IN_DB.set_self_id" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_UPPER">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_UPPER</tt><a class="headerlink" href="#gluon.validators.IS_UPPER" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_NULL_OR">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_NULL_OR</tt><big>(</big><em>other</em>, <em>null=None</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_NULL_OR" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.validators.Validator</span></tt></p>
<dl class="method">
<dt id="gluon.validators.IS_NULL_OR.formatter">
<tt class="descname">formatter</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_NULL_OR.formatter" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.validators.IS_NULL_OR.set_self_id">
<tt class="descname">set_self_id</tt><big>(</big><em>id</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_NULL_OR.set_self_id" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.validators.IS_STRONG">
<em class="property">
class </em><tt class="descclassname">gluon.validators.</tt><tt class="descname">IS_STRONG</tt><big>(</big><em>min=8</em>, <em>max=20</em>, <em>upper=1</em>, <em>lower=1</em>, <em>number=1</em>, <em>special=1</em>, <em>specials='~!&#64;#$%^&amp;*()_+-=?&lt;&gt;</em>, <em>.:;{}</em><span class="optional">[</span><span class="optional">]</span>, <em>|'</em>, <em>invalid=' &quot;'</em>, <em>error_message=None</em><big>)</big><a class="headerlink" href="#gluon.validators.IS_STRONG" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;password&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;passwd&#39;</span><span class="p">,</span>
    <span class="n">requires</span><span class="o">=</span><span class="n">IS_STRONG</span><span class="p">(</span><span class="nb">min</span><span class="o">=</span><span class="mf">10</span><span class="p">,</span> <span class="n">special</span><span class="o">=</span><span class="mf">2</span><span class="p">,</span> <span class="n">upper</span><span class="o">=</span><span class="mf">2</span><span class="p">))</span>
</pre></div>
</div>
<p>enforces complexity requirements on a field</p>
</dd></dl>

</div>
<div class="section" id="module-gluon.sql">
<h2>The <tt class="xref docutils literal"><span class="pre">sql</span></tt> Module<a class="headerlink" href="#module-gluon.sql" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<dl class="docutils">
<dt>Thanks to </dt>
<dd><ul class="first last simple">
<li>Niall Sweeny &lt;<a class="reference external" href="mailto:niall&#46;sweeny&#37;&#52;&#48;fonjax&#46;com">niall<span>&#46;</span>sweeny<span>&#64;</span>fonjax<span>&#46;</span>com</a>&gt; for MSSQL support</li>
<li>Marcel Leuthi &lt;<a class="reference external" href="mailto:mluethi&#37;&#52;&#48;mlsystems&#46;ch">mluethi<span>&#64;</span>mlsystems<span>&#46;</span>ch</a>&gt; for Oracle support</li>
</ul>
</dd>
</dl>
<p>This file contains the DAL support for many relational databases,
like SQLite, MySQL, Postgres, Oracle, MS-Sql, DB2, Interbase.</p>
<dl class="class">
<dt id="gluon.sql.SQLDB">
<em class="property">
class </em><tt class="descclassname">gluon.sql.</tt><tt class="descname">SQLDB</tt><big>(</big><em>uri='sqlite://dummy.db'</em>, <em>pool_size=0</em>, <em>pools=0</em><big>)</big><a class="headerlink" href="#gluon.sql.SQLDB" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.sql.SQLStorage</span></tt></p>
<p>an instance of this class represents a database connection</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">db</span><span class="o">=</span><span class="n">SQLDB</span><span class="p">(</span><span class="s">&#39;sqlite://test.db&#39;</span><span class="p">)</span>
<span class="n">db</span><span class="o">.</span><span class="n">define_table</span><span class="p">(</span><span class="s">&#39;tablename&#39;</span><span class="p">,</span> <span class="n">SQLField</span><span class="p">(</span><span class="s">&#39;fieldname1&#39;</span><span class="p">),</span>
                            <span class="n">SQLField</span><span class="p">(</span><span class="s">&#39;fieldname2&#39;</span><span class="p">))</span>
</pre></div>
</div>
<dl class="attribute">
<dt id="gluon.sql.SQLDB.Field">
<tt class="descname">Field</tt><a class="headerlink" href="#gluon.sql.SQLDB.Field" title="Permalink to this definition">¶</a></dt>
<dd>alias of <a title="gluon.sql.SQLField" class="reference internal" href="#gluon.sql.SQLField"><tt class="xref docutils literal"><span class="pre">SQLField</span></tt></a></dd></dl>

<dl class="attribute">
<dt id="gluon.sql.SQLDB.Table">
<tt class="descname">Table</tt><a class="headerlink" href="#gluon.sql.SQLDB.Table" title="Permalink to this definition">¶</a></dt>
<dd>alias of <tt class="xref docutils literal"><span class="pre">SQLTable</span></tt></dd></dl>

<dl class="staticmethod">
<dt id="gluon.sql.SQLDB.close_all_instances">
<em class="property">
static </em><tt class="descname">close_all_instances</tt><big>(</big><em>action</em><big>)</big><a class="headerlink" href="#gluon.sql.SQLDB.close_all_instances" title="Permalink to this definition">¶</a></dt>
<dd>to close cleanly databases in a multithreaded environment</dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLDB.commit">
<tt class="descname">commit</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.sql.SQLDB.commit" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLDB.define_table">
<tt class="descname">define_table</tt><big>(</big><em>tablename</em>, <em>*fields</em>, <em>**args</em><big>)</big><a class="headerlink" href="#gluon.sql.SQLDB.define_table" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="staticmethod">
<dt id="gluon.sql.SQLDB.distributed_transaction_commit">
<em class="property">
static </em><tt class="descname">distributed_transaction_commit</tt><big>(</big><em>*instances</em><big>)</big><a class="headerlink" href="#gluon.sql.SQLDB.distributed_transaction_commit" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLDB.executesql">
<tt class="descname">executesql</tt><big>(</big><em>query</em><big>)</big><a class="headerlink" href="#gluon.sql.SQLDB.executesql" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLDB.export_to_csv_file">
<tt class="descname">export_to_csv_file</tt><big>(</big><em>ofile</em><big>)</big><a class="headerlink" href="#gluon.sql.SQLDB.export_to_csv_file" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLDB.import_from_csv_file">
<tt class="descname">import_from_csv_file</tt><big>(</big><em>ifile</em>, <em>id_map={}</em><big>)</big><a class="headerlink" href="#gluon.sql.SQLDB.import_from_csv_file" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLDB.rollback">
<tt class="descname">rollback</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.sql.SQLDB.rollback" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.sql.SQLField">
<em class="property">
class </em><tt class="descclassname">gluon.sql.</tt><tt class="descname">SQLField</tt><big>(</big><em>fieldname</em>, <em>type='string'</em>, <em>length=None</em>, <em>default=None</em>, <em>required=False</em>, <em>requires=&lt;function sqlhtml_validators at 0x2084270&gt;</em>, <em>ondelete='CASCADE'</em>, <em>notnull=False</em>, <em>unique=False</em>, <em>uploadfield=True</em>, <em>widget=None</em>, <em>label=None</em>, <em>comment=None</em>, <em>writable=True</em>, <em>readable=True</em>, <em>update=None</em>, <em>authorize=None</em>, <em>autodelete=False</em>, <em>represent=None</em><big>)</big><a class="headerlink" href="#gluon.sql.SQLField" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.sql.SQLXorable</span></tt></p>
<p>an instance of this class represents a database field</p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">a</span> <span class="o">=</span> <span class="n">SQLField</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="s">&#39;string&#39;</span><span class="p">,</span> <span class="n">length</span><span class="o">=</span><span class="mf">32</span><span class="p">,</span> <span class="n">required</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> 
    <span class="n">requires</span><span class="o">=</span><span class="n">IS_NOT_EMPTY</span><span class="p">(),</span> <span class="n">notnull</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">unique</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
    <span class="n">uploadfield</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">widget</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">comment</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
    <span class="n">writable</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">readable</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">update</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">authorize</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
    <span class="n">autodelete</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">represent</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
</pre></div>
</div>
<p>to be used as argument of SQLDB.define_table</p>
<p>allowed field types:
string, boolean, integer, double, text, blob,
date, time, datetime, upload, password</p>
<p>strings must have a length or 32 by default.
fields should have a default or they will be required in SQLFORMs
the requires argument is used to validate the field input in SQLFORMs</p>
<dl class="method">
<dt id="gluon.sql.SQLField.count">
<tt class="descname">count</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.sql.SQLField.count" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLField.day">
<tt class="descname">day</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.sql.SQLField.day" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLField.formatter">
<tt class="descname">formatter</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#gluon.sql.SQLField.formatter" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLField.hour">
<tt class="descname">hour</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.sql.SQLField.hour" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLField.lower">
<tt class="descname">lower</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.sql.SQLField.lower" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLField.max">
<tt class="descname">max</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.sql.SQLField.max" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLField.min">
<tt class="descname">min</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.sql.SQLField.min" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLField.minutes">
<tt class="descname">minutes</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.sql.SQLField.minutes" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLField.month">
<tt class="descname">month</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.sql.SQLField.month" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLField.seconds">
<tt class="descname">seconds</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.sql.SQLField.seconds" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLField.sum">
<tt class="descname">sum</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.sql.SQLField.sum" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLField.upper">
<tt class="descname">upper</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.sql.SQLField.upper" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLField.validate">
<tt class="descname">validate</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#gluon.sql.SQLField.validate" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.sql.SQLField.year">
<tt class="descname">year</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.sql.SQLField.year" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

</div>
<div class="section" id="module-gluon.xmlrpc">
<h2>The <tt class="xref docutils literal"><span class="pre">xmlrpc</span></tt> Module<a class="headerlink" href="#module-gluon.xmlrpc" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<dl class="function">
<dt id="gluon.xmlrpc.handler">
<tt class="descclassname">gluon.xmlrpc.</tt><tt class="descname">handler</tt><big>(</big><em>request</em>, <em>response</em>, <em>methods</em><big>)</big><a class="headerlink" href="#gluon.xmlrpc.handler" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div>
<div class="section" id="module-gluon.shell">
<h2>The <tt class="xref docutils literal"><span class="pre">shell</span></tt> Module<a class="headerlink" href="#module-gluon.shell" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;, 
limodou &lt;<a class="reference external" href="mailto:limodou&#37;&#52;&#48;gmail&#46;com">limodou<span>&#64;</span>gmail<span>&#46;</span>com</a>&gt; and srackham &lt;<a class="reference external" href="mailto:srackham&#37;&#52;&#48;gmail&#46;com">srackham<span>&#64;</span>gmail<span>&#46;</span>com</a>&gt;.
License: GPL v2</p>
<dl class="function">
<dt id="gluon.shell.die">
<tt class="descclassname">gluon.shell.</tt><tt class="descname">die</tt><big>(</big><em>msg</em><big>)</big><a class="headerlink" href="#gluon.shell.die" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="gluon.shell.env">
<tt class="descclassname">gluon.shell.</tt><tt class="descname">env</tt><big>(</big><em>a</em>, <em>import_models=False</em>, <em>c=None</em>, <em>f=None</em>, <em>dir=''</em><big>)</big><a class="headerlink" href="#gluon.shell.env" title="Permalink to this definition">¶</a></dt>
<dd>Return web2py execution environment for application (a), controller (c),
function (f).
If import_models is True the exec all application models into the
environment.</dd></dl>

<dl class="function">
<dt id="gluon.shell.exec_environment">
<tt class="descclassname">gluon.shell.</tt><tt class="descname">exec_environment</tt><big>(</big><em>pyfile=''</em>, <em>request=&lt;Storage {'function': None</em>, <em>'cookies': &lt;Storage {}&gt;</em>, <em>'extension': None</em>, <em>'vars': &lt;Storage {}&gt;</em>, <em>'args':</em><span class="optional">[</span><span class="optional">]</span>, <em>'application': None</em>, <em>'env': &lt;Storage {}&gt;</em>, <em>'get_vars': &lt;Storage {}&gt;</em>, <em>'folder': None</em>, <em>'now': datetime.datetime(2009</em>, <em>6</em>, <em>30</em>, <em>21</em>, <em>6</em>, <em>36</em>, <em>555781)</em>, <em>'post_vars': &lt;Storage {}&gt;}&gt;</em>, <em>response=&lt;Storage {'status': 200</em>, <em>'body': &lt;cStringIO.StringO object at 0x30e9940&gt;</em>, <em>'cookies': &lt;Storage {}&gt;</em>, <em>'_view_environment': None</em>, <em>'_vars': None</em>, <em>'description': ''</em>, <em>'menu': None</em>, <em>'flash': None</em>, <em>'session_id': None</em>, <em>'headers': &lt;Storage {}&gt;</em>, <em>'postprocessing':</em><span class="optional">[</span><span class="optional">]</span>, <em>'_caller': &lt;function &lt;lambda&gt; at 0x30ffbf0&gt;</em>, <em>'keywords': ''</em>, <em>'_custom_commit': None</em>, <em>'_custom_rollback': None}&gt;</em>, <em>session=&lt;Storage {}&gt;</em><big>)</big><a class="headerlink" href="#gluon.shell.exec_environment" title="Permalink to this definition">¶</a></dt>
<dd><dl class="function">
<dt>
<tt class="descname">gluon.shell.exec_environment([pyfile=''[, request=Request()</tt></dt>
<dt>
<tt class="descname">[, response=Response[, sessions=Session()]]]])</tt></dt>
<dd><p>Environment builder and module loader.</p>
<p>Builds a web2py environment and optionally executes a Python
file into the environment.
A Storage dictionary containing the resulting environment is returned.
The working directory must be web2py root &#8211; this is the web2py default.</p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="gluon.shell.exec_pythonrc">
<tt class="descclassname">gluon.shell.</tt><tt class="descname">exec_pythonrc</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.shell.exec_pythonrc" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="gluon.shell.execute_from_command_line">
<tt class="descclassname">gluon.shell.</tt><tt class="descname">execute_from_command_line</tt><big>(</big><em>argv=None</em><big>)</big><a class="headerlink" href="#gluon.shell.execute_from_command_line" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="gluon.shell.get_usage">
<tt class="descclassname">gluon.shell.</tt><tt class="descname">get_usage</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.shell.get_usage" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="gluon.shell.parse_path_info">
<tt class="descclassname">gluon.shell.</tt><tt class="descname">parse_path_info</tt><big>(</big><em>path_info</em><big>)</big><a class="headerlink" href="#gluon.shell.parse_path_info" title="Permalink to this definition">¶</a></dt>
<dd>Parse path info formatted like a/c/f where c and f are optional
and a leading / accepted.
Return tuple (a,c,f). If invalid path_info a is set to None.
If c or f are omitted they are set to None.</dd></dl>

<dl class="function">
<dt id="gluon.shell.run">
<tt class="descclassname">gluon.shell.</tt><tt class="descname">run</tt><big>(</big><em>appname</em>, <em>plain=False</em>, <em>import_models=False</em>, <em>startfile=None</em><big>)</big><a class="headerlink" href="#gluon.shell.run" title="Permalink to this definition">¶</a></dt>
<dd><p>Start interactive shell or run Python script (startfile) in web2py
controller environment. appname is formatted like:</p>
<p>a      web2py application name
a/c    exec the controller c into the application environment</p>
</dd></dl>

<dl class="function">
<dt id="gluon.shell.test">
<tt class="descclassname">gluon.shell.</tt><tt class="descname">test</tt><big>(</big><em>testpath</em>, <em>import_models=True</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#gluon.shell.test" title="Permalink to this definition">¶</a></dt>
<dd><p>Run doctests in web2py environment. testpath is formatted like:</p>
<p>a      tests all controllers in application a
a/c    tests controller c in application a
a/c/f  test function f in controller c, application a</p>
<p>Where a, c and f are application, controller and function names
respectively. If the testpath is a file name the file is tested.
If a controller is specified models are executed by default.</p>
</dd></dl>

</div>
<div class="section" id="module-gluon.utils">
<h2>The <tt class="xref docutils literal"><span class="pre">utils</span></tt> Module<a class="headerlink" href="#module-gluon.utils" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<dl class="function">
<dt id="gluon.utils.hash">
<tt class="descclassname">gluon.utils.</tt><tt class="descname">hash</tt><big>(</big><em>text</em>, <em>digest_alg='md5'</em><big>)</big><a class="headerlink" href="#gluon.utils.hash" title="Permalink to this definition">¶</a></dt>
<dd>Generates hash with the given text using the specified 
digest hashing algorithm</dd></dl>

<dl class="function">
<dt id="gluon.utils.md5_hash">
<tt class="descclassname">gluon.utils.</tt><tt class="descname">md5_hash</tt><big>(</big><em>text</em><big>)</big><a class="headerlink" href="#gluon.utils.md5_hash" title="Permalink to this definition">¶</a></dt>
<dd>Generate a md5 hash with the given text</dd></dl>

</div>
<div class="section" id="module-gluon.globals">
<h2>The <tt class="xref docutils literal"><span class="pre">globals</span></tt> Module<a class="headerlink" href="#module-gluon.globals" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<p>Contains the classes for the global used variables:</p>
<ul class="simple">
<li>Request</li>
<li>Response</li>
<li>Session</li>
</ul>
<dl class="class">
<dt id="gluon.globals.Request">
<em class="property">
class </em><tt class="descclassname">gluon.globals.</tt><tt class="descname">Request</tt><a class="headerlink" href="#gluon.globals.Request" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.storage.Storage" class="reference internal" href="#gluon.storage.Storage"><tt class="xref docutils literal"><span class="pre">gluon.storage.Storage</span></tt></a></p>
<p>defines the request object and the default values of its members</p>
<ul class="simple">
<li>env: environment variables, by gluon.main.wsgibase()</li>
<li>cookies</li>
<li>get_vars</li>
<li>post_vars</li>
<li>vars</li>
<li>folder</li>
<li>application</li>
<li>function</li>
<li>args</li>
<li>extension</li>
<li>now: datetime.datetime.today()</li>
</ul>
</dd></dl>

<dl class="class">
<dt id="gluon.globals.Response">
<em class="property">
class </em><tt class="descclassname">gluon.globals.</tt><tt class="descname">Response</tt><a class="headerlink" href="#gluon.globals.Response" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.storage.Storage" class="reference internal" href="#gluon.storage.Storage"><tt class="xref docutils literal"><span class="pre">gluon.storage.Storage</span></tt></a></p>
<p>defines the response object and the default values of its members
response.write(   ) can be used to write in the output html</p>
<dl class="method">
<dt id="gluon.globals.Response.download">
<tt class="descname">download</tt><big>(</big><em>request</em>, <em>db</em>, <em>chunk_size=1000000</em><big>)</big><a class="headerlink" href="#gluon.globals.Response.download" title="Permalink to this definition">¶</a></dt>
<dd><p>example of usage in controller:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">download</span><span class="p">():</span> 
    <span class="k">return</span> <span class="n">response</span><span class="o">.</span><span class="n">download</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">db</span><span class="p">)</span>
</pre></div>
</div>
<p>downloads from <a class="reference external" href="http://..../download/filename">http://..../download/filename</a></p>
</dd></dl>

<dl class="method">
<dt id="gluon.globals.Response.json">
<tt class="descname">json</tt><big>(</big><em>data</em><big>)</big><a class="headerlink" href="#gluon.globals.Response.json" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.globals.Response.render">
<tt class="descname">render</tt><big>(</big><em>*a</em>, <em>**b</em><big>)</big><a class="headerlink" href="#gluon.globals.Response.render" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.globals.Response.stream">
<tt class="descname">stream</tt><big>(</big><em>stream</em>, <em>chunk_size=1000000</em>, <em>request=None</em><big>)</big><a class="headerlink" href="#gluon.globals.Response.stream" title="Permalink to this definition">¶</a></dt>
<dd><p>if a controller function:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">return</span> <span class="n">response</span><span class="o">.</span><span class="n">stream</span><span class="p">(</span><span class="nb">file</span><span class="p">,</span> <span class="mf">100</span><span class="p">)</span>
</pre></div>
</div>
<p>the file content will be streamed at 100 bytes at the time</p>
</dd></dl>

<dl class="method">
<dt id="gluon.globals.Response.write">
<tt class="descname">write</tt><big>(</big><em>data</em>, <em>escape=True</em><big>)</big><a class="headerlink" href="#gluon.globals.Response.write" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.globals.Response.xmlrpc">
<tt class="descname">xmlrpc</tt><big>(</big><em>request</em>, <em>methods</em><big>)</big><a class="headerlink" href="#gluon.globals.Response.xmlrpc" title="Permalink to this definition">¶</a></dt>
<dd><p>assuming:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">add</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
    <span class="k">return</span> <span class="n">a</span><span class="o">+</span><span class="n">b</span>
</pre></div>
</div>
<p>if a controller function &#8220;func&#8221;:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">return</span> <span class="n">response</span><span class="o">.</span><span class="n">xmlrpc</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="p">[</span><span class="n">add</span><span class="p">])</span>
</pre></div>
</div>
<p>the controller will be able to handle xmlrpc requests for 
the add function. Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">xmlrpclib</span>
<span class="n">connection</span> <span class="o">=</span> <span class="n">xmlrpclib</span><span class="o">.</span><span class="n">ServerProxy</span><span class="p">(</span><span class="s">&#39;http://hostname/app/contr/func&#39;</span><span class="p">)</span>
<span class="k">print</span> <span class="n">connection</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="mf">3</span><span class="p">,</span> <span class="mf">4</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.globals.Session">
<em class="property">
class </em><tt class="descclassname">gluon.globals.</tt><tt class="descname">Session</tt><a class="headerlink" href="#gluon.globals.Session" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.storage.Storage" class="reference internal" href="#gluon.storage.Storage"><tt class="xref docutils literal"><span class="pre">gluon.storage.Storage</span></tt></a></p>
<p>defines the session object and the default values of its members (None)</p>
<dl class="method">
<dt id="gluon.globals.Session.connect">
<tt class="descname">connect</tt><big>(</big><em>request</em>, <em>response</em>, <em>db=None</em>, <em>tablename='web2py_session'</em>, <em>masterapp=None</em>, <em>migrate=True</em><big>)</big><a class="headerlink" href="#gluon.globals.Session.connect" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.globals.Session.forget">
<tt class="descname">forget</tt><big>(</big><em>response=None</em><big>)</big><a class="headerlink" href="#gluon.globals.Session.forget" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.globals.Session.secure">
<tt class="descname">secure</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.globals.Session.secure" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

</div>
<div class="section" id="module-gluon.compileapp">
<h2>The <tt class="xref docutils literal"><span class="pre">compileapp</span></tt> Module<a class="headerlink" href="#module-gluon.compileapp" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<div class="section" id="functions-required-to-execute-app-components">
<h3>Functions required to execute app components<a class="headerlink" href="#functions-required-to-execute-app-components" title="Permalink to this headline">¶</a></h3>
<p>FOR INTERNAL USE ONLY</p>
<dl class="function">
<dt id="gluon.compileapp.build_environment">
<tt class="descclassname">gluon.compileapp.</tt><tt class="descname">build_environment</tt><big>(</big><em>request</em>, <em>response</em>, <em>session</em><big>)</big><a class="headerlink" href="#gluon.compileapp.build_environment" title="Permalink to this definition">¶</a></dt>
<dd>Build the environment dictionary into which web2py files are executed.</dd></dl>

<dl class="function">
<dt id="gluon.compileapp.compile_application">
<tt class="descclassname">gluon.compileapp.</tt><tt class="descname">compile_application</tt><big>(</big><em>folder</em><big>)</big><a class="headerlink" href="#gluon.compileapp.compile_application" title="Permalink to this definition">¶</a></dt>
<dd>Compiles all models, views, controller for the application in <cite>folder</cite>.</dd></dl>

<dl class="function">
<dt id="gluon.compileapp.compile_controllers">
<tt class="descclassname">gluon.compileapp.</tt><tt class="descname">compile_controllers</tt><big>(</big><em>folder</em><big>)</big><a class="headerlink" href="#gluon.compileapp.compile_controllers" title="Permalink to this definition">¶</a></dt>
<dd>Compiles all the controllers in the application specified by <cite>folder</cite></dd></dl>

<dl class="function">
<dt id="gluon.compileapp.compile_models">
<tt class="descclassname">gluon.compileapp.</tt><tt class="descname">compile_models</tt><big>(</big><em>folder</em><big>)</big><a class="headerlink" href="#gluon.compileapp.compile_models" title="Permalink to this definition">¶</a></dt>
<dd>Compiles all the models in the application specified by <cite>folder</cite></dd></dl>

<dl class="function">
<dt id="gluon.compileapp.compile_views">
<tt class="descclassname">gluon.compileapp.</tt><tt class="descname">compile_views</tt><big>(</big><em>folder</em><big>)</big><a class="headerlink" href="#gluon.compileapp.compile_views" title="Permalink to this definition">¶</a></dt>
<dd>Compiles all the views in the application specified by <cite>folder</cite></dd></dl>

<dl class="function">
<dt id="gluon.compileapp.getcfs">
<tt class="descclassname">gluon.compileapp.</tt><tt class="descname">getcfs</tt><big>(</big><em>key</em>, <em>filename</em>, <em>filter=None</em><big>)</big><a class="headerlink" href="#gluon.compileapp.getcfs" title="Permalink to this definition">¶</a></dt>
<dd><p>Caches the <em>filtered</em> file <cite>filename</cite> with <cite>key</cite> until the file is modifiled.
<cite>filter</cite> is the function used for filtering. Normally <cite>filename</cite> is a .py file
and <cite>filter</cite> is a function that bytecode compiles the file. In this way the
bytecode compiled file is cached.</p>
<p>This is used on Google App Engine since pyc files cannot be saved.</p>
</dd></dl>

<dl class="function">
<dt id="gluon.compileapp.read_pyc">
<tt class="descclassname">gluon.compileapp.</tt><tt class="descname">read_pyc</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#gluon.compileapp.read_pyc" title="Permalink to this definition">¶</a></dt>
<dd>Read the code inside a bytecode compiled file if the MAGIC number is compatible
Returns a code object</dd></dl>

<dl class="function">
<dt id="gluon.compileapp.remove_compiled_application">
<tt class="descclassname">gluon.compileapp.</tt><tt class="descname">remove_compiled_application</tt><big>(</big><em>folder</em><big>)</big><a class="headerlink" href="#gluon.compileapp.remove_compiled_application" title="Permalink to this definition">¶</a></dt>
<dd>Deletes the folder <cite>compiled</cite> containing the compiled application.</dd></dl>

<dl class="function">
<dt id="gluon.compileapp.run_controller_in">
<tt class="descclassname">gluon.compileapp.</tt><tt class="descname">run_controller_in</tt><big>(</big><em>controller</em>, <em>function</em>, <em>environment</em><big>)</big><a class="headerlink" href="#gluon.compileapp.run_controller_in" title="Permalink to this definition">¶</a></dt>
<dd>Runs the controller.function() (for the app specified by 
the current folder).
It tries pre-compiled controller_function.pyc first before compiling it.</dd></dl>

<dl class="function">
<dt id="gluon.compileapp.run_models_in">
<tt class="descclassname">gluon.compileapp.</tt><tt class="descname">run_models_in</tt><big>(</big><em>environment</em><big>)</big><a class="headerlink" href="#gluon.compileapp.run_models_in" title="Permalink to this definition">¶</a></dt>
<dd>Runs all models (in the app specified by the current folder) 
It tries pre-compiled models first before compiling them.</dd></dl>

<dl class="function">
<dt id="gluon.compileapp.run_view_in">
<tt class="descclassname">gluon.compileapp.</tt><tt class="descname">run_view_in</tt><big>(</big><em>environment</em><big>)</big><a class="headerlink" href="#gluon.compileapp.run_view_in" title="Permalink to this definition">¶</a></dt>
<dd>Executes the view for the requested action.
The view is the one specified in <cite>response.view</cite> or deterined by the url
or <cite>view/generic.extension</cite>
It tries the pre-compiled views_controller_function.pyc before comiling it.</dd></dl>

<dl class="function">
<dt id="gluon.compileapp.save_pyc">
<tt class="descclassname">gluon.compileapp.</tt><tt class="descname">save_pyc</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#gluon.compileapp.save_pyc" title="Permalink to this definition">¶</a></dt>
<dd>Bytecode compiles the file <cite>filename</cite></dd></dl>

<dl class="function">
<dt id="gluon.compileapp.test">
<tt class="descclassname">gluon.compileapp.</tt><tt class="descname">test</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.compileapp.test" title="Permalink to this definition">¶</a></dt>
<dd><p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">traceback</span><span class="o">,</span> <span class="nn">types</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">environment</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;x&#39;</span><span class="p">:</span><span class="mf">1</span><span class="p">}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">open</span><span class="p">(</span><span class="s">&#39;a.py&#39;</span><span class="p">,</span><span class="s">&#39;w&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">&#39;print 1/x&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">save_pyc</span><span class="p">(</span><span class="s">&#39;a.py&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="s">&#39;a.py&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="n">read_pyc</span><span class="p">(</span><span class="s">&#39;a.pyc&#39;</span><span class="p">))</span><span class="o">==</span><span class="n">types</span><span class="o">.</span><span class="n">CodeType</span><span class="p">:</span> <span class="k">print</span> <span class="s">&#39;code&#39;</span>
<span class="go">code</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">exec</span> <span class="n">read_pyc</span><span class="p">(</span><span class="s">&#39;a.pyc&#39;</span><span class="p">)</span> <span class="ow">in</span> <span class="n">environment</span>
<span class="go">1</span>
</pre></div>
</div>
</dd></dl>

</div>
</div>
<div class="section" id="module-gluon.wsgiserver">
<h2>The <tt class="xref docutils literal"><span class="pre">wsgiserver</span></tt> Module<a class="headerlink" href="#module-gluon.wsgiserver" title="Permalink to this headline">¶</a></h2>
<p>High-speed, production ready, thread pooled, generic WSGI server.</p>
<p>Simplest example on how to use this module directly
(without using CherryPy&#8217;s application machinery):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">cherrypy</span> <span class="kn">import</span> <span class="n">wsgiserver</span>

<span class="k">def</span> <span class="nf">my_crazy_app</span><span class="p">(</span><span class="n">environ</span><span class="p">,</span> <span class="n">start_response</span><span class="p">):</span>
    <span class="n">status</span> <span class="o">=</span> <span class="s">&#39;200 OK&#39;</span>
    <span class="n">response_headers</span> <span class="o">=</span> <span class="p">[(</span><span class="s">&#39;Content-type&#39;</span><span class="p">,</span><span class="s">&#39;text/plain&#39;</span><span class="p">)]</span>
    <span class="n">start_response</span><span class="p">(</span><span class="n">status</span><span class="p">,</span> <span class="n">response_headers</span><span class="p">)</span>
    <span class="k">return</span> <span class="p">[</span><span class="s">&#39;Hello world!&#39;</span><span class="p">]</span>

<span class="n">server</span> <span class="o">=</span> <span class="n">wsgiserver</span><span class="o">.</span><span class="n">CherryPyWSGIServer</span><span class="p">(</span>
            <span class="p">(</span><span class="s">&#39;0.0.0.0&#39;</span><span class="p">,</span> <span class="mf">8070</span><span class="p">),</span> <span class="n">my_crazy_app</span><span class="p">,</span>
            <span class="n">server_name</span><span class="o">=</span><span class="s">&#39;www.cherrypy.example&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>The CherryPy WSGI server can serve as many WSGI applications 
as you want in one instance by using a WSGIPathInfoDispatcher:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">d</span> <span class="o">=</span> <span class="n">WSGIPathInfoDispatcher</span><span class="p">({</span><span class="s">&#39;/&#39;</span><span class="p">:</span> <span class="n">my_crazy_app</span><span class="p">,</span> <span class="s">&#39;/blog&#39;</span><span class="p">:</span> <span class="n">my_blog_app</span><span class="p">})</span>
<span class="n">server</span> <span class="o">=</span> <span class="n">wsgiserver</span><span class="o">.</span><span class="n">CherryPyWSGIServer</span><span class="p">((</span><span class="s">&#39;0.0.0.0&#39;</span><span class="p">,</span> <span class="mf">80</span><span class="p">),</span> <span class="n">d</span><span class="p">)</span>
</pre></div>
</div>
<p>Want SSL support? Just set these attributes:</p>
<div class="highlight-python"><pre>server.ssl_certificate = &lt;filename&gt;
server.ssl_private_key = &lt;filename&gt;

if __name__ == '__main__':
    try:
        server.start()
    except KeyboardInterrupt:
        server.stop()</pre>
</div>
<p>This won&#8217;t call the CherryPy engine (application side) at all, only the
WSGI server, which is independent from the rest of CherryPy. Don&#8217;t
let the name &#8220;CherryPyWSGIServer&#8221; throw you; the name merely reflects
its origin, not its coupling.</p>
<dl class="class">
<dt id="gluon.wsgiserver.CherryPyWSGIServer">
<em class="property">
class </em><tt class="descclassname">gluon.wsgiserver.</tt><tt class="descname">CherryPyWSGIServer</tt><big>(</big><em>bind_addr</em>, <em>wsgi_app</em>, <em>numthreads=10</em>, <em>server_name=None</em>, <em>max=-1</em>, <em>request_queue_size=5</em>, <em>timeout=10</em>, <em>shutdown_timeout=5</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.CherryPyWSGIServer" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>An HTTP server for WSGI.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>bind_addr</em> &#8211; The interface on which to listen for connections.
For TCP sockets, a (host, port) tuple. Host values may be any IPv4
or IPv6 address, or any valid hostname. The string &#8216;localhost&#8217; is a
synonym for &#8216;127.0.0.1&#8217; (or &#8216;::1&#8217;, if your hosts file prefers IPv6).
The string &#8216;0.0.0.0&#8217; is a special IPv4 entry meaning &#8220;any active
interface&#8221; (INADDR_ANY), and &#8216;::&#8217; is the similar IN6ADDR_ANY for
IPv6. The empty string or None are not allowed.
For UNIX sockets, supply the filename as a string.</li>
<li><em>wsgi_app</em> &#8211; the WSGI &#8216;application callable&#8217;; multiple WSGI applications
may be passed as (path_prefix, app) pairs.</li>
<li><em>numthreads</em> &#8211; the number of worker threads to create (default 10).</li>
<li><em>server_name</em> &#8211; the string to set for WSGI&#8217;s SERVER_NAME environ entry.
Defaults to socket.gethostname().</li>
<li><em>max</em> &#8211; the maximum number of queued requests (defaults to -1 = no limit).</li>
<li><em>request_queue_size</em> &#8211; the &#8216;backlog&#8217; argument to socket.listen();
specifies the maximum number of queued connections (default 5).</li>
<li><em>timeout</em> &#8211; the timeout in seconds for accepted connections (default 10).</li>
<li><em>protocol</em> &#8211; the version string to write in the Status-Line of all
HTTP responses. For example, &#8220;HTTP/1.1&#8221; (the default). This
also limits the supported features used in the response.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="gluon.wsgiserver.CherryPyWSGIServer.ConnectionClass">
<tt class="descname">ConnectionClass</tt><a class="headerlink" href="#gluon.wsgiserver.CherryPyWSGIServer.ConnectionClass" title="Permalink to this definition">¶</a></dt>
<dd>alias of <a title="gluon.wsgiserver.HTTPConnection" class="reference internal" href="#gluon.wsgiserver.HTTPConnection"><tt class="xref docutils literal"><span class="pre">HTTPConnection</span></tt></a></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.CherryPyWSGIServer.bind">
<tt class="descname">bind</tt><big>(</big><em>family</em>, <em>type</em>, <em>proto=0</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.CherryPyWSGIServer.bind" title="Permalink to this definition">¶</a></dt>
<dd>Create (or recreate) the actual socket object.</dd></dl>

<dl class="attribute">
<dt id="gluon.wsgiserver.CherryPyWSGIServer.bind_addr">
<tt class="descname">bind_addr</tt><a class="headerlink" href="#gluon.wsgiserver.CherryPyWSGIServer.bind_addr" title="Permalink to this definition">¶</a></dt>
<dd><p>The interface on which to listen for connections.</p>
<p>For TCP sockets, a (host, port) tuple. Host values may be any IPv4
or IPv6 address, or any valid hostname. The string &#8216;localhost&#8217; is a
synonym for &#8216;127.0.0.1&#8217; (or &#8216;::1&#8217;, if your hosts file prefers IPv6).
The string &#8216;0.0.0.0&#8217; is a special IPv4 entry meaning &#8220;any active
interface&#8221; (INADDR_ANY), and &#8216;::&#8217; is the similar IN6ADDR_ANY for
IPv6. The empty string or None are not allowed.</p>
<p>For UNIX sockets, supply the filename as a string.</p>
</dd></dl>

<dl class="attribute">
<dt id="gluon.wsgiserver.CherryPyWSGIServer.interrupt">
<tt class="descname">interrupt</tt><a class="headerlink" href="#gluon.wsgiserver.CherryPyWSGIServer.interrupt" title="Permalink to this definition">¶</a></dt>
<dd>Set this to an Exception instance to interrupt the server.</dd></dl>

<dl class="attribute">
<dt id="gluon.wsgiserver.CherryPyWSGIServer.numthreads">
<tt class="descname">numthreads</tt><a class="headerlink" href="#gluon.wsgiserver.CherryPyWSGIServer.numthreads" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.CherryPyWSGIServer.populate_ssl_environ">
<tt class="descname">populate_ssl_environ</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.CherryPyWSGIServer.populate_ssl_environ" title="Permalink to this definition">¶</a></dt>
<dd>Create WSGI environ entries to be merged into each request.</dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.CherryPyWSGIServer.start">
<tt class="descname">start</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.CherryPyWSGIServer.start" title="Permalink to this definition">¶</a></dt>
<dd>Run the server forever.</dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.CherryPyWSGIServer.stop">
<tt class="descname">stop</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.CherryPyWSGIServer.stop" title="Permalink to this definition">¶</a></dt>
<dd>Gracefully shutdown a server that is serving forever.</dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.CherryPyWSGIServer.tick">
<tt class="descname">tick</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.CherryPyWSGIServer.tick" title="Permalink to this definition">¶</a></dt>
<dd>Accept a new connection and put it on the Queue.</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.wsgiserver.HTTPConnection">
<em class="property">
class </em><tt class="descclassname">gluon.wsgiserver.</tt><tt class="descname">HTTPConnection</tt><big>(</big><em>sock</em>, <em>wsgi_app</em>, <em>environ</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.HTTPConnection" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>An HTTP connection (active socket).</p>
<p>socket: the raw socket object (usually TCP) for this connection.
wsgi_app: the WSGI application for this server/connection.
environ: a WSGI environ template. This will be copied for each request.</p>
<p>rfile: a fileobject for reading from the socket.
sendall: a function for writing (+ flush) to the socket.</p>
<dl class="attribute">
<dt id="gluon.wsgiserver.HTTPConnection.RequestHandlerClass">
<tt class="descname">RequestHandlerClass</tt><a class="headerlink" href="#gluon.wsgiserver.HTTPConnection.RequestHandlerClass" title="Permalink to this definition">¶</a></dt>
<dd>alias of <a title="gluon.wsgiserver.HTTPRequest" class="reference internal" href="#gluon.wsgiserver.HTTPRequest"><tt class="xref docutils literal"><span class="pre">HTTPRequest</span></tt></a></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.HTTPConnection.close">
<tt class="descname">close</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.HTTPConnection.close" title="Permalink to this definition">¶</a></dt>
<dd>Close the socket underlying this connection.</dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.HTTPConnection.communicate">
<tt class="descname">communicate</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.HTTPConnection.communicate" title="Permalink to this definition">¶</a></dt>
<dd>Read each request and respond appropriately.</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.wsgiserver.HTTPRequest">
<em class="property">
class </em><tt class="descclassname">gluon.wsgiserver.</tt><tt class="descname">HTTPRequest</tt><big>(</big><em>sendall</em>, <em>environ</em>, <em>wsgi_app</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.HTTPRequest" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>An HTTP Request (and response).</p>
<p>A single HTTP connection may consist of multiple request/response pairs.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>sendall</em> &#8211; the &#8216;sendall&#8217; method from the connection&#8217;s fileobject.</li>
<li><em>wsgi_app</em> &#8211; the WSGI application to call.</li>
<li><em>environ</em> &#8211; <p>a partial WSGI environ (server and connection entries).
The caller MUST set the following entries:</p>
<ul>
<li>All wsgi.* entries, including .input</li>
<li>SERVER_NAME and SERVER_PORT</li>
<li>Any SSL_* entries</li>
<li>Any custom entries like REMOTE_ADDR and REMOTE_PORT</li>
<li>SERVER_SOFTWARE: the value to write in the &#8220;Server&#8221; response header.</li>
<li><dl class="first docutils">
<dt>ACTUAL_SERVER_PROTOCOL: the value to write in the Status-Line of</dt>
<dd>the response. From RFC 2145: &#8220;An HTTP server SHOULD send a
response version equal to the highest version for which the
server is at least conditionally compliant, and whose major
version is less than or equal to the one received in the
request.  An HTTP server MUST NOT send a version for which
it is not at least conditionally compliant.&#8221;</dd>
</dl>
</li>
</ul>
</li>
<li><em>outheaders</em> &#8211; a list of header tuples to write in the response.</li>
<li><em>ready</em> &#8211; when True, the request has been parsed and is ready to begin
generating the response. When False, signals the calling Connection
that the response should not be generated and the connection should
close.</li>
<li><em>close_connection</em> &#8211; signals the calling Connection that the request
should close. This does not imply an error! The client and/or
server may each request that the connection be closed.</li>
<li><em>chunked_write</em> &#8211; if True, output will be encoded with the &#8220;chunked&#8221;
transfer-coding. This value is set automatically inside
send_headers.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="gluon.wsgiserver.HTTPRequest.decode_chunked">
<tt class="descname">decode_chunked</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.HTTPRequest.decode_chunked" title="Permalink to this definition">¶</a></dt>
<dd>Decode the &#8216;chunked&#8217; transfer coding.</dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.HTTPRequest.parse_request">
<tt class="descname">parse_request</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.HTTPRequest.parse_request" title="Permalink to this definition">¶</a></dt>
<dd>Parse the next HTTP request start-line and message-headers.</dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.HTTPRequest.read_headers">
<tt class="descname">read_headers</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.HTTPRequest.read_headers" title="Permalink to this definition">¶</a></dt>
<dd>Read header lines from the incoming stream.</dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.HTTPRequest.respond">
<tt class="descname">respond</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.HTTPRequest.respond" title="Permalink to this definition">¶</a></dt>
<dd>Call the appropriate WSGI app and write its iterable output.</dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.HTTPRequest.send_headers">
<tt class="descname">send_headers</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.HTTPRequest.send_headers" title="Permalink to this definition">¶</a></dt>
<dd>Assert, process, and send the HTTP response message-headers.</dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.HTTPRequest.simple_response">
<tt class="descname">simple_response</tt><big>(</big><em>status</em>, <em>msg=''</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.HTTPRequest.simple_response" title="Permalink to this definition">¶</a></dt>
<dd>Write a simple response back to the client.</dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.HTTPRequest.start_response">
<tt class="descname">start_response</tt><big>(</big><em>status</em>, <em>headers</em>, <em>exc_info=None</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.HTTPRequest.start_response" title="Permalink to this definition">¶</a></dt>
<dd>WSGI callable to begin the HTTP response.</dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.HTTPRequest.write">
<tt class="descname">write</tt><big>(</big><em>chunk</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.HTTPRequest.write" title="Permalink to this definition">¶</a></dt>
<dd><p>WSGI callable to write unbuffered data to the client.</p>
<p>This method is also used internally by start_response (to write
data from the iterable returned by the WSGI application).</p>
</dd></dl>

</dd></dl>

<dl class="exception">
<dt id="gluon.wsgiserver.MaxSizeExceeded">
<em class="property">
exception </em><tt class="descclassname">gluon.wsgiserver.</tt><tt class="descname">MaxSizeExceeded</tt><a class="headerlink" href="#gluon.wsgiserver.MaxSizeExceeded" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/exceptions.html#exceptions.Exception"><tt class="xref docutils literal"><span class="pre">exceptions.Exception</span></tt></a></dd></dl>

<dl class="exception">
<dt id="gluon.wsgiserver.NoSSLError">
<em class="property">
exception </em><tt class="descclassname">gluon.wsgiserver.</tt><tt class="descname">NoSSLError</tt><a class="headerlink" href="#gluon.wsgiserver.NoSSLError" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/exceptions.html#exceptions.Exception"><tt class="xref docutils literal"><span class="pre">exceptions.Exception</span></tt></a></p>
<p>Exception raised when a client speaks HTTP to an HTTPS socket.</p>
</dd></dl>

<dl class="class">
<dt id="gluon.wsgiserver.SSLConnection">
<em class="property">
class </em><tt class="descclassname">gluon.wsgiserver.</tt><tt class="descname">SSLConnection</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection" title="Permalink to this definition">¶</a></dt>
<dd><p>A thread-safe wrapper for an SSL.Connection.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>args</em> &#8211; the arguments to create the wrapped SSL.Connection.</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.accept">
<tt class="descname">accept</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.accept" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.bind">
<tt class="descname">bind</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.bind" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.close">
<tt class="descname">close</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.close" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.connect">
<tt class="descname">connect</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.connect" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.connect_ex">
<tt class="descname">connect_ex</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.connect_ex" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.fileno">
<tt class="descname">fileno</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.fileno" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.get_app_data">
<tt class="descname">get_app_data</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.get_app_data" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.get_cipher_list">
<tt class="descname">get_cipher_list</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.get_cipher_list" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.get_context">
<tt class="descname">get_context</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.get_context" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.get_peer_certificate">
<tt class="descname">get_peer_certificate</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.get_peer_certificate" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.getpeername">
<tt class="descname">getpeername</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.getpeername" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.getsockname">
<tt class="descname">getsockname</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.getsockname" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.getsockopt">
<tt class="descname">getsockopt</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.getsockopt" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.listen">
<tt class="descname">listen</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.listen" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.makefile">
<tt class="descname">makefile</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.makefile" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.pending">
<tt class="descname">pending</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.pending" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.read">
<tt class="descname">read</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.read" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.recv">
<tt class="descname">recv</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.recv" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.renegotiate">
<tt class="descname">renegotiate</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.renegotiate" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.send">
<tt class="descname">send</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.send" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.sendall">
<tt class="descname">sendall</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.sendall" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.set_accept_state">
<tt class="descname">set_accept_state</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.set_accept_state" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.set_app_data">
<tt class="descname">set_app_data</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.set_app_data" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.set_connect_state">
<tt class="descname">set_connect_state</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.set_connect_state" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.setblocking">
<tt class="descname">setblocking</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.setblocking" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.setsockopt">
<tt class="descname">setsockopt</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.setsockopt" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.settimeout">
<tt class="descname">settimeout</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.settimeout" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.shutdown">
<tt class="descname">shutdown</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.shutdown" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.sock_shutdown">
<tt class="descname">sock_shutdown</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.sock_shutdown" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.state_string">
<tt class="descname">state_string</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.state_string" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.want_read">
<tt class="descname">want_read</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.want_read" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.want_write">
<tt class="descname">want_write</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.want_write" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSLConnection.write">
<tt class="descname">write</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSLConnection.write" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.wsgiserver.SSL_fileobject">
<em class="property">
class </em><tt class="descclassname">gluon.wsgiserver.</tt><tt class="descname">SSL_fileobject</tt><big>(</big><em>sock</em>, <em>mode='rb'</em>, <em>bufsize=-1</em>, <em>close=False</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSL_fileobject" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">socket._fileobject</span></tt></p>
<p>Faux file object attached to a socket object.</p>
<dl class="method">
<dt id="gluon.wsgiserver.SSL_fileobject.close">
<tt class="descname">close</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSL_fileobject.close" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSL_fileobject.flush">
<tt class="descname">flush</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSL_fileobject.flush" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSL_fileobject.read">
<tt class="descname">read</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSL_fileobject.read" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSL_fileobject.readline">
<tt class="descname">readline</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSL_fileobject.readline" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSL_fileobject.readlines">
<tt class="descname">readlines</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSL_fileobject.readlines" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSL_fileobject.write">
<tt class="descname">write</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSL_fileobject.write" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SSL_fileobject.writelines">
<tt class="descname">writelines</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SSL_fileobject.writelines" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.wsgiserver.SizeCheckWrapper">
<em class="property">
class </em><tt class="descclassname">gluon.wsgiserver.</tt><tt class="descname">SizeCheckWrapper</tt><big>(</big><em>rfile</em>, <em>maxlen</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SizeCheckWrapper" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>Wraps a file-like object, raising MaxSizeExceeded if too large.</p>
<dl class="method">
<dt id="gluon.wsgiserver.SizeCheckWrapper.close">
<tt class="descname">close</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SizeCheckWrapper.close" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SizeCheckWrapper.next">
<tt class="descname">next</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SizeCheckWrapper.next" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SizeCheckWrapper.read">
<tt class="descname">read</tt><big>(</big><em>size=None</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SizeCheckWrapper.read" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SizeCheckWrapper.readline">
<tt class="descname">readline</tt><big>(</big><em>size=None</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SizeCheckWrapper.readline" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.SizeCheckWrapper.readlines">
<tt class="descname">readlines</tt><big>(</big><em>sizehint=0</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.SizeCheckWrapper.readlines" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.wsgiserver.ThreadPool">
<em class="property">
class </em><tt class="descclassname">gluon.wsgiserver.</tt><tt class="descname">ThreadPool</tt><big>(</big><em>server</em>, <em>min=10</em>, <em>max=-1</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.ThreadPool" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>A Request Queue for the CherryPyWSGIServer which pools threads.</p>
<dl class="method">
<dt id="gluon.wsgiserver.ThreadPool.grow">
<tt class="descname">grow</tt><big>(</big><em>amount</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.ThreadPool.grow" title="Permalink to this definition">¶</a></dt>
<dd>Spawn new worker threads (not above self.max).</dd></dl>

<dl class="attribute">
<dt id="gluon.wsgiserver.ThreadPool.idle">
<tt class="descname">idle</tt><a class="headerlink" href="#gluon.wsgiserver.ThreadPool.idle" title="Permalink to this definition">¶</a></dt>
<dd>Number of worker threads which are idle. Read-only.</dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.ThreadPool.put">
<tt class="descname">put</tt><big>(</big><em>obj</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.ThreadPool.put" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.ThreadPool.shrink">
<tt class="descname">shrink</tt><big>(</big><em>amount</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.ThreadPool.shrink" title="Permalink to this definition">¶</a></dt>
<dd>Kill off worker threads (not below self.min).</dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.ThreadPool.start">
<tt class="descname">start</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.ThreadPool.start" title="Permalink to this definition">¶</a></dt>
<dd>Start the pool of threads.</dd></dl>

<dl class="method">
<dt id="gluon.wsgiserver.ThreadPool.stop">
<tt class="descname">stop</tt><big>(</big><em>timeout=5</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.ThreadPool.stop" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.wsgiserver.WSGIPathInfoDispatcher">
<em class="property">
class </em><tt class="descclassname">gluon.wsgiserver.</tt><tt class="descname">WSGIPathInfoDispatcher</tt><big>(</big><em>apps</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.WSGIPathInfoDispatcher" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>A WSGI dispatcher for dispatch based on the PATH_INFO.</p>
<p>apps: a dict or list of (path_prefix, app) pairs.</p>
</dd></dl>

<dl class="class">
<dt id="gluon.wsgiserver.WorkerThread">
<em class="property">
class </em><tt class="descclassname">gluon.wsgiserver.</tt><tt class="descname">WorkerThread</tt><big>(</big><em>server</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.WorkerThread" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/threading.html#threading.Thread"><tt class="xref docutils literal"><span class="pre">threading.Thread</span></tt></a></p>
<p>Thread which continuously polls a Queue for Connection objects.</p>
<dl class="docutils">
<dt>server: the HTTP Server which spawned this thread, and which owns the</dt>
<dd>Queue and is placing active connections into it.</dd>
<dt>ready: a simple flag for the calling server to know when this thread</dt>
<dd>has begun polling the Queue.</dd>
</dl>
<p>Due to the timing issues of polling a Queue, a WorkerThread does not
check its own &#8216;ready&#8217; flag after it has started. To stop the thread,
it is necessary to stick a _SHUTDOWNREQUEST object onto the Queue
(one for each running WorkerThread).</p>
<dl class="method">
<dt id="gluon.wsgiserver.WorkerThread.run">
<tt class="descname">run</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.wsgiserver.WorkerThread.run" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="function">
<dt id="gluon.wsgiserver.format_exc">
<tt class="descclassname">gluon.wsgiserver.</tt><tt class="descname">format_exc</tt><big>(</big><em>limit=None</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.format_exc" title="Permalink to this definition">¶</a></dt>
<dd>Like print_exc() but return a string. Backport for Python 2.3.</dd></dl>

<dl class="function">
<dt id="gluon.wsgiserver.plat_specific_errors">
<tt class="descclassname">gluon.wsgiserver.</tt><tt class="descname">plat_specific_errors</tt><big>(</big><em>*errnames</em><big>)</big><a class="headerlink" href="#gluon.wsgiserver.plat_specific_errors" title="Permalink to this definition">¶</a></dt>
<dd><p>Return error numbers for all errors in errnames on this platform.</p>
<p>The &#8216;errno&#8217; module contains different global constants depending on
the specific platform (OS). This function will return the list of
numeric values for a given list of potential names.</p>
</dd></dl>

</div>
<div class="section" id="the-winservice-module">
<h2>The <tt class="xref docutils literal"><span class="pre">winservice</span></tt> Module<a class="headerlink" href="#the-winservice-module" title="Permalink to this headline">¶</a></h2>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">/Users/mdipierro/web2py/doc/source/gluon/gluon.rst</tt>, line 81)</p>
autodoc can&#8217;t import/find module &#8216;gluon.winservice&#8217;, it reported error: &#8220;No module named win32serviceutil&#8221;, please check your spelling and sys.path</div>
</div>
<div class="section" id="module-gluon.template">
<h2>The <tt class="xref docutils literal"><span class="pre">template</span></tt> Module<a class="headerlink" href="#module-gluon.template" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<dl class="function">
<dt id="gluon.template.parse">
<tt class="descclassname">gluon.template.</tt><tt class="descname">parse</tt><big>(</big><em>text</em><big>)</big><a class="headerlink" href="#gluon.template.parse" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="gluon.template.reindent">
<tt class="descclassname">gluon.template.</tt><tt class="descname">reindent</tt><big>(</big><em>text</em><big>)</big><a class="headerlink" href="#gluon.template.reindent" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="gluon.template.parse_template">
<tt class="descclassname">gluon.template.</tt><tt class="descname">parse_template</tt><big>(</big><em>filename</em>, <em>path='views/'</em>, <em>cache='cache/'</em>, <em>context={}</em><big>)</big><a class="headerlink" href="#gluon.template.parse_template" title="Permalink to this definition">¶</a></dt>
<dd>filename can be a view filename in the views/ folder or an imput stream
path is the path of a views folder
context is a dictionary of symbols used to render the template</dd></dl>

</div>
<div class="section" id="module-gluon.fileutils">
<h2>The <tt class="xref docutils literal"><span class="pre">fileutils</span></tt> Module<a class="headerlink" href="#module-gluon.fileutils" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<dl class="function">
<dt id="gluon.fileutils.listdir">
<tt class="descclassname">gluon.fileutils.</tt><tt class="descname">listdir</tt><big>(</big><em>path</em>, <em>expression='^.+$'</em>, <em>drop=True</em>, <em>add_dirs=False</em><big>)</big><a class="headerlink" href="#gluon.fileutils.listdir" title="Permalink to this definition">¶</a></dt>
<dd>like os.listdir() but you can specify a regex patter to filter filed.
if add_dirs==True the returned items will have the full path.</dd></dl>

<dl class="function">
<dt id="gluon.fileutils.cleanpath">
<tt class="descclassname">gluon.fileutils.</tt><tt class="descname">cleanpath</tt><big>(</big><em>path</em><big>)</big><a class="headerlink" href="#gluon.fileutils.cleanpath" title="Permalink to this definition">¶</a></dt>
<dd>turns any expression/path into a valid filename. replaces / with _ and 
removes special characters.</dd></dl>

<dl class="function">
<dt id="gluon.fileutils.tar">
<tt class="descclassname">gluon.fileutils.</tt><tt class="descname">tar</tt><big>(</big><em>file</em>, <em>dir</em>, <em>expression='^.+$'</em><big>)</big><a class="headerlink" href="#gluon.fileutils.tar" title="Permalink to this definition">¶</a></dt>
<dd>tars dir into file, only tars file that match expression</dd></dl>

<dl class="function">
<dt id="gluon.fileutils.untar">
<tt class="descclassname">gluon.fileutils.</tt><tt class="descname">untar</tt><big>(</big><em>file</em>, <em>dir</em><big>)</big><a class="headerlink" href="#gluon.fileutils.untar" title="Permalink to this definition">¶</a></dt>
<dd>untar file into dir</dd></dl>

<dl class="function">
<dt id="gluon.fileutils.tar_compiled">
<tt class="descclassname">gluon.fileutils.</tt><tt class="descname">tar_compiled</tt><big>(</big><em>file</em>, <em>dir</em>, <em>expression='^.+$'</em><big>)</big><a class="headerlink" href="#gluon.fileutils.tar_compiled" title="Permalink to this definition">¶</a></dt>
<dd>used to tar a compiled application.
the content of models, views, controllers is not stored in the tar file.</dd></dl>

<dl class="function">
<dt id="gluon.fileutils.get_session">
<tt class="descclassname">gluon.fileutils.</tt><tt class="descname">get_session</tt><big>(</big><em>request</em>, <em>other_application='admin'</em><big>)</big><a class="headerlink" href="#gluon.fileutils.get_session" title="Permalink to this definition">¶</a></dt>
<dd>checks that user is authorized to access other_application</dd></dl>

<dl class="function">
<dt id="gluon.fileutils.check_credentials">
<tt class="descclassname">gluon.fileutils.</tt><tt class="descname">check_credentials</tt><big>(</big><em>request</em>, <em>other_application='admin'</em><big>)</big><a class="headerlink" href="#gluon.fileutils.check_credentials" title="Permalink to this definition">¶</a></dt>
<dd>checks that user is authorized to access other_application</dd></dl>

</div>
<div class="section" id="module-gluon.sqlhtml">
<h2>The <tt class="xref docutils literal"><span class="pre">sqlhtml</span></tt> Module<a class="headerlink" href="#module-gluon.sqlhtml" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<p>Holds:</p>
<ul class="simple">
<li>SQLFORM: provide a form for a table (with/without record)</li>
<li>SQLTABLE: provides a table for a set of records</li>
<li>form_factory: provides a SQLFORM for an non-db backed table</li>
</ul>
<dl class="class">
<dt id="gluon.sqlhtml.BooleanWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">BooleanWidget</tt><a class="headerlink" href="#gluon.sqlhtml.BooleanWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.sqlhtml.FormWidget" class="reference internal" href="#gluon.sqlhtml.FormWidget"><tt class="xref docutils literal"><span class="pre">gluon.sqlhtml.FormWidget</span></tt></a></p>
<dl class="staticmethod">
<dt id="gluon.sqlhtml.BooleanWidget.widget">
<em class="property">
static </em><tt class="descname">widget</tt><big>(</big><em>field</em>, <em>value</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.BooleanWidget.widget" title="Permalink to this definition">¶</a></dt>
<dd><p>generates an INPUT checkbox tag.</p>
<p>see also: <a title="gluon.sqlhtml.FormWidget.widget" class="reference internal" href="#gluon.sqlhtml.FormWidget.widget"><tt class="xref docutils literal"><span class="pre">FormWidget.widget()</span></tt></a></p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.CheckboxesWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">CheckboxesWidget</tt><a class="headerlink" href="#gluon.sqlhtml.CheckboxesWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.sqlhtml.OptionsWidget" class="reference internal" href="#gluon.sqlhtml.OptionsWidget"><tt class="xref docutils literal"><span class="pre">gluon.sqlhtml.OptionsWidget</span></tt></a></p>
<dl class="staticmethod">
<dt id="gluon.sqlhtml.CheckboxesWidget.widget">
<em class="property">
static </em><tt class="descname">widget</tt><big>(</big><em>field</em>, <em>value</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.CheckboxesWidget.widget" title="Permalink to this definition">¶</a></dt>
<dd><p>generates a TABLE tag, including INPUT checkboxes (multiple allowed)</p>
<p>see also: <a title="gluon.sqlhtml.FormWidget.widget" class="reference internal" href="#gluon.sqlhtml.FormWidget.widget"><tt class="xref docutils literal"><span class="pre">FormWidget.widget()</span></tt></a></p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.DateWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">DateWidget</tt><a class="headerlink" href="#gluon.sqlhtml.DateWidget" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.sqlhtml.StringWidget" class="reference internal" href="#gluon.sqlhtml.StringWidget"><tt class="xref docutils literal"><span class="pre">gluon.sqlhtml.StringWidget</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.DatetimeWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">DatetimeWidget</tt><a class="headerlink" href="#gluon.sqlhtml.DatetimeWidget" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.sqlhtml.StringWidget" class="reference internal" href="#gluon.sqlhtml.StringWidget"><tt class="xref docutils literal"><span class="pre">gluon.sqlhtml.StringWidget</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.DoubleWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">DoubleWidget</tt><a class="headerlink" href="#gluon.sqlhtml.DoubleWidget" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.sqlhtml.StringWidget" class="reference internal" href="#gluon.sqlhtml.StringWidget"><tt class="xref docutils literal"><span class="pre">gluon.sqlhtml.StringWidget</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.FormWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">FormWidget</tt><a class="headerlink" href="#gluon.sqlhtml.FormWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>helper for SQLFORM to generate form input fields (widget), 
related to the fieldtype</p>
<dl class="staticmethod">
<dt id="gluon.sqlhtml.FormWidget.widget">
<em class="property">
static </em><tt class="descname">widget</tt><big>(</big><em>field</em>, <em>value</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.FormWidget.widget" title="Permalink to this definition">¶</a></dt>
<dd><p>generates the widget for the field.</p>
<p>When serialized, will provide an INPUT tag:</p>
<ul class="simple">
<li>id = tablename_fieldname</li>
<li>class = field.type</li>
<li>name = fieldname</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>field</em> &#8211; the field needing the widget</li>
<li><em>value</em> &#8211; value</li>
<li><em>attributes</em> &#8211; any other attributes to be applied</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.IntegerWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">IntegerWidget</tt><a class="headerlink" href="#gluon.sqlhtml.IntegerWidget" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.sqlhtml.StringWidget" class="reference internal" href="#gluon.sqlhtml.StringWidget"><tt class="xref docutils literal"><span class="pre">gluon.sqlhtml.StringWidget</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.MultipleOptionsWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">MultipleOptionsWidget</tt><a class="headerlink" href="#gluon.sqlhtml.MultipleOptionsWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.sqlhtml.OptionsWidget" class="reference internal" href="#gluon.sqlhtml.OptionsWidget"><tt class="xref docutils literal"><span class="pre">gluon.sqlhtml.OptionsWidget</span></tt></a></p>
<dl class="staticmethod">
<dt id="gluon.sqlhtml.MultipleOptionsWidget.widget">
<em class="property">
static </em><tt class="descname">widget</tt><big>(</big><em>field</em>, <em>value</em>, <em>size=5</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.MultipleOptionsWidget.widget" title="Permalink to this definition">¶</a></dt>
<dd><p>generates a SELECT tag, including OPTIONs (multiple options allowed)</p>
<p>see also: <a title="gluon.sqlhtml.FormWidget.widget" class="reference internal" href="#gluon.sqlhtml.FormWidget.widget"><tt class="xref docutils literal"><span class="pre">FormWidget.widget()</span></tt></a></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>size</em> &#8211; optional param (default=5) to indicate how many rows must
be shown</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.OptionsWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">OptionsWidget</tt><a class="headerlink" href="#gluon.sqlhtml.OptionsWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.sqlhtml.FormWidget" class="reference internal" href="#gluon.sqlhtml.FormWidget"><tt class="xref docutils literal"><span class="pre">gluon.sqlhtml.FormWidget</span></tt></a></p>
<dl class="staticmethod">
<dt id="gluon.sqlhtml.OptionsWidget.has_options">
<em class="property">
static </em><tt class="descname">has_options</tt><big>(</big><em>field</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.OptionsWidget.has_options" title="Permalink to this definition">¶</a></dt>
<dd><p>checks if the field has selectable options</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>field</em> &#8211; the field needing checking</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">True if the field has options</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="staticmethod">
<dt id="gluon.sqlhtml.OptionsWidget.widget">
<em class="property">
static </em><tt class="descname">widget</tt><big>(</big><em>field</em>, <em>value</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.OptionsWidget.widget" title="Permalink to this definition">¶</a></dt>
<dd><p>generates a SELECT tag, including OPTIONs (only 1 option allowed)</p>
<p>see also: <a title="gluon.sqlhtml.FormWidget.widget" class="reference internal" href="#gluon.sqlhtml.FormWidget.widget"><tt class="xref docutils literal"><span class="pre">FormWidget.widget()</span></tt></a></p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.PasswordWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">PasswordWidget</tt><a class="headerlink" href="#gluon.sqlhtml.PasswordWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.sqlhtml.FormWidget" class="reference internal" href="#gluon.sqlhtml.FormWidget"><tt class="xref docutils literal"><span class="pre">gluon.sqlhtml.FormWidget</span></tt></a></p>
<dl class="staticmethod">
<dt id="gluon.sqlhtml.PasswordWidget.widget">
<em class="property">
static </em><tt class="descname">widget</tt><big>(</big><em>field</em>, <em>value</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.PasswordWidget.widget" title="Permalink to this definition">¶</a></dt>
<dd><p>generates a INPUT password tag.
If a value is present it will be shown as a number of &#8216;*&#8217;, not related
to the length of the actual value.</p>
<p>see also: <a title="gluon.sqlhtml.FormWidget.widget" class="reference internal" href="#gluon.sqlhtml.FormWidget.widget"><tt class="xref docutils literal"><span class="pre">FormWidget.widget()</span></tt></a></p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.RadioWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">RadioWidget</tt><a class="headerlink" href="#gluon.sqlhtml.RadioWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.sqlhtml.OptionsWidget" class="reference internal" href="#gluon.sqlhtml.OptionsWidget"><tt class="xref docutils literal"><span class="pre">gluon.sqlhtml.OptionsWidget</span></tt></a></p>
<dl class="staticmethod">
<dt id="gluon.sqlhtml.RadioWidget.widget">
<em class="property">
static </em><tt class="descname">widget</tt><big>(</big><em>field</em>, <em>value</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.RadioWidget.widget" title="Permalink to this definition">¶</a></dt>
<dd><p>generates a TABLE tag, including INPUT radios (only 1 option allowed)</p>
<p>see also: <a title="gluon.sqlhtml.FormWidget.widget" class="reference internal" href="#gluon.sqlhtml.FormWidget.widget"><tt class="xref docutils literal"><span class="pre">FormWidget.widget()</span></tt></a></p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.SQLFORM">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">SQLFORM</tt><big>(</big><em>table</em>, <em>record=None</em>, <em>deletable=False</em>, <em>linkto=None</em>, <em>upload=None</em>, <em>fields=None</em>, <em>labels=None</em>, <em>col3={}</em>, <em>submit_button='Submit'</em>, <em>delete_label='Check to delete:'</em>, <em>showid=True</em>, <em>readonly=False</em>, <em>comments=True</em>, <em>keepopts=</em><span class="optional">[</span><span class="optional">]</span>, <em>ignore_rw=False</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.SQLFORM" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.FORM" class="reference internal" href="#gluon.html.FORM"><tt class="xref docutils literal"><span class="pre">gluon.html.FORM</span></tt></a></p>
<p>SQLFORM is used to map a table (and a current record) into an HTML form</p>
<p>given a SQLTable stored in db.table</p>
<p>generates an insert form:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">SQLFORM</span><span class="p">(</span><span class="n">db</span><span class="o">.</span><span class="n">table</span><span class="p">)</span> 
</pre></div>
</div>
<p>generates an update form:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">record</span><span class="o">=</span><span class="n">db</span><span class="p">(</span><span class="n">db</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">id</span><span class="o">==</span><span class="n">some_id</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">()[</span><span class="mf">0</span><span class="p">]</span>
<span class="n">SQLFORM</span><span class="p">(</span><span class="n">db</span><span class="o">.</span><span class="n">table</span><span class="p">,</span> <span class="n">record</span><span class="p">)</span> 
</pre></div>
</div>
<p>generates an update with a delete button:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">SQLFORM</span><span class="p">(</span><span class="n">db</span><span class="o">.</span><span class="n">table</span><span class="p">,</span> <span class="n">record</span><span class="p">,</span> <span class="n">deletable</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span> 
</pre></div>
</div>
<p>if record is an int:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">record</span><span class="o">=</span><span class="n">db</span><span class="p">(</span><span class="n">db</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">id</span><span class="o">==</span><span class="n">record</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">()[</span><span class="mf">0</span><span class="p">]</span>
</pre></div>
</div>
<p>optional arguments:</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>fields</em> &#8211; a list of fields that should be placed in the form, default is all.</li>
<li><em>labels</em> &#8211; a dictionary with labels for each field. keys are field names.</li>
<li><em>col3</em> &#8211; a dictionary with content for an optional third column
(right of each field). keys are field names.</li>
<li><em>linkto</em> &#8211; the URL of a controller/function to access referencedby records
see controller appadmin.py for examples</li>
<li><em>upload</em> &#8211; the URL of a controller/function to download an uploaded file
see controller appadmin.py for examples</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="docutils">
<dt>any named optional attribute is passed to the &lt;form&gt; tag</dt>
<dd>for example _class, _id, _style, _action,_method, etc.</dd>
</dl>
<dl class="method">
<dt id="gluon.sqlhtml.SQLFORM.accepts">
<tt class="descname">accepts</tt><big>(</big><em>request_vars</em>, <em>session=None</em>, <em>formname='%(tablename)s_%(record_id)s'</em>, <em>keepvalues=False</em>, <em>onvalidation=None</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.SQLFORM.accepts" title="Permalink to this definition">¶</a></dt>
<dd>same as FORM.accepts but also does insert, update or delete in SQLDB.</dd></dl>

<dl class="staticmethod">
<dt id="gluon.sqlhtml.SQLFORM.factory">
<em class="property">
static </em><tt class="descname">factory</tt><big>(</big><em>*fields</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.SQLFORM.factory" title="Permalink to this definition">¶</a></dt>
<dd><p>generates a SQLFORM for the given fields.</p>
<p>Internally will build a non-database based data model 
to hold the fields.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.SQLTABLE">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">SQLTABLE</tt><big>(</big><em>sqlrows</em>, <em>linkto=None</em>, <em>upload=None</em>, <em>orderby=None</em>, <em>headers={}</em>, <em>truncate=16</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.SQLTABLE" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.TABLE" class="reference internal" href="#gluon.html.TABLE"><tt class="xref docutils literal"><span class="pre">gluon.html.TABLE</span></tt></a></p>
<p>given a SQLRows object, as returned by a db().select(), generates
an html table with the rows.</p>
<p>optional arguments:</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>linkto</em> &#8211; URL to edit individual records</li>
<li><em>upload</em> &#8211; URL to download uploaded files</li>
<li><em>orderby</em> &#8211; Add an orderby link to column headers.</li>
<li><em>headers</em> &#8211; dictionary of headers to headers redefinions</li>
<li><em>truncate</em> &#8211; length at which to truncate text in table cells.
Defaults to 16 characters.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>optional names attributes for passed to the &lt;table&gt; tag</p>
</dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.StringWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">StringWidget</tt><a class="headerlink" href="#gluon.sqlhtml.StringWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.sqlhtml.FormWidget" class="reference internal" href="#gluon.sqlhtml.FormWidget"><tt class="xref docutils literal"><span class="pre">gluon.sqlhtml.FormWidget</span></tt></a></p>
<dl class="staticmethod">
<dt id="gluon.sqlhtml.StringWidget.widget">
<em class="property">
static </em><tt class="descname">widget</tt><big>(</big><em>field</em>, <em>value</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.StringWidget.widget" title="Permalink to this definition">¶</a></dt>
<dd><p>generates an INPUT text tag.</p>
<p>see also: <a title="gluon.sqlhtml.FormWidget.widget" class="reference internal" href="#gluon.sqlhtml.FormWidget.widget"><tt class="xref docutils literal"><span class="pre">FormWidget.widget()</span></tt></a></p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.TextWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">TextWidget</tt><a class="headerlink" href="#gluon.sqlhtml.TextWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.sqlhtml.FormWidget" class="reference internal" href="#gluon.sqlhtml.FormWidget"><tt class="xref docutils literal"><span class="pre">gluon.sqlhtml.FormWidget</span></tt></a></p>
<dl class="staticmethod">
<dt id="gluon.sqlhtml.TextWidget.widget">
<em class="property">
static </em><tt class="descname">widget</tt><big>(</big><em>field</em>, <em>value</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.TextWidget.widget" title="Permalink to this definition">¶</a></dt>
<dd><p>generates a TEXTAREA tag.</p>
<p>see also: <a title="gluon.sqlhtml.FormWidget.widget" class="reference internal" href="#gluon.sqlhtml.FormWidget.widget"><tt class="xref docutils literal"><span class="pre">FormWidget.widget()</span></tt></a></p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.TimeWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">TimeWidget</tt><a class="headerlink" href="#gluon.sqlhtml.TimeWidget" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.sqlhtml.StringWidget" class="reference internal" href="#gluon.sqlhtml.StringWidget"><tt class="xref docutils literal"><span class="pre">gluon.sqlhtml.StringWidget</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.sqlhtml.UploadWidget">
<em class="property">
class </em><tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">UploadWidget</tt><a class="headerlink" href="#gluon.sqlhtml.UploadWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.sqlhtml.FormWidget" class="reference internal" href="#gluon.sqlhtml.FormWidget"><tt class="xref docutils literal"><span class="pre">gluon.sqlhtml.FormWidget</span></tt></a></p>
<dl class="staticmethod">
<dt id="gluon.sqlhtml.UploadWidget.is_image">
<em class="property">
static </em><tt class="descname">is_image</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.UploadWidget.is_image" title="Permalink to this definition">¶</a></dt>
<dd><p>Tries to check if the filename provided references to an image</p>
<dl class="docutils">
<dt>Checking is based on filename extension. Currently recognized:</dt>
<dd>gif, png, jp(e)g, bmp</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>value</em> &#8211; filename</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="staticmethod">
<dt id="gluon.sqlhtml.UploadWidget.represent">
<em class="property">
static </em><tt class="descname">represent</tt><big>(</big><em>field</em>, <em>value</em>, <em>download_url=None</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.UploadWidget.represent" title="Permalink to this definition">¶</a></dt>
<dd><p>how to represent the file:</p>
<ul class="simple">
<li>with download url and if it is an image: &lt;A href=...&gt;&lt;IMG ...&gt;&lt;/A&gt;</li>
<li>otherwise with download url: &lt;A href=...&gt;file&lt;/A&gt;</li>
<li>otherwise: file</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>field</em> &#8211; the field</li>
<li><em>value</em> &#8211; the field value</li>
<li><em>download_url</em> &#8211; url for the file download 9default = None)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="staticmethod">
<dt id="gluon.sqlhtml.UploadWidget.widget">
<em class="property">
static </em><tt class="descname">widget</tt><big>(</big><em>field</em>, <em>value</em>, <em>download_url=None</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.UploadWidget.widget" title="Permalink to this definition">¶</a></dt>
<dd><p>generates a INPUT file tag.</p>
<p>Optionally provides an A link to the file, including a checkbox so
the file can be deleted.
All is wrapped in a DIV.</p>
<p>see also: <a title="gluon.sqlhtml.FormWidget.widget" class="reference internal" href="#gluon.sqlhtml.FormWidget.widget"><tt class="xref docutils literal"><span class="pre">FormWidget.widget()</span></tt></a></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>download_url</em> &#8211; Optional URL to link to the file (default = None)</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="gluon.sqlhtml.form_factory">
<tt class="descclassname">gluon.sqlhtml.</tt><tt class="descname">form_factory</tt><big>(</big><em>*fields</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.sqlhtml.form_factory" title="Permalink to this definition">¶</a></dt>
<dd><p>generates a SQLFORM for the given fields.</p>
<p>Internally will build a non-database based data model 
to hold the fields.</p>
</dd></dl>

</div>
<div class="section" id="module-gluon.tools">
<h2>The <tt class="xref docutils literal"><span class="pre">tools</span></tt> Module<a class="headerlink" href="#module-gluon.tools" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<dl class="class">
<dt id="gluon.tools.Mail">
<em class="property">
class </em><tt class="descclassname">gluon.tools.</tt><tt class="descname">Mail</tt><a class="headerlink" href="#gluon.tools.Mail" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>Class for configuring and sending emails.
Works with SMTP and Google App Engine</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">contrib.utils</span> <span class="kn">import</span> <span class="o">*</span>
<span class="n">mail</span><span class="o">=</span><span class="n">Mail</span><span class="p">()</span>
<span class="n">mail</span><span class="o">.</span><span class="n">settings</span><span class="o">.</span><span class="n">server</span><span class="o">=</span><span class="s">&#39;smtp.gmail.com:587&#39;</span>
<span class="n">mail</span><span class="o">.</span><span class="n">settings</span><span class="o">.</span><span class="n">sender</span><span class="o">=</span><span class="s">&#39;you@somewhere.com&#39;</span>
<span class="n">mail</span><span class="o">.</span><span class="n">settings</span><span class="o">.</span><span class="n">login</span><span class="o">=</span><span class="bp">None</span> <span class="ow">or</span> <span class="s">&#39;username:password&#39;</span>
<span class="n">mail</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">to</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;you@whatever.com&#39;</span><span class="p">],</span><span class="n">subject</span><span class="o">=</span><span class="s">&#39;None&#39;</span><span class="p">,</span><span class="n">message</span><span class="o">=</span><span class="s">&#39;None&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>In Google App Engine use:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">mail</span><span class="o">.</span><span class="n">settings</span><span class="o">.</span><span class="n">server</span><span class="o">=</span><span class="s">&#39;gae&#39;</span>
</pre></div>
</div>
<dl class="method">
<dt id="gluon.tools.Mail.send">
<tt class="descname">send</tt><big>(</big><em>to</em>, <em>subject='None'</em>, <em>message='None'</em><big>)</big><a class="headerlink" href="#gluon.tools.Mail.send" title="Permalink to this definition">¶</a></dt>
<dd>Sends an email. Returns True on success, False on failure.</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.tools.Auth">
<em class="property">
class </em><tt class="descclassname">gluon.tools.</tt><tt class="descname">Auth</tt><big>(</big><em>environment</em>, <em>db=None</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>Class for authentication, authorization, role based access control.</p>
<p>Includes:</p>
<ul class="simple">
<li>registration and profile</li>
<li>login and logout</li>
<li>username and password retrieval</li>
<li>event logging</li>
<li>role creation and assignment</li>
<li>user defined group/role based permission</li>
</ul>
<p>Authentication Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">contrib.utils</span> <span class="kn">import</span> <span class="o">*</span>
<span class="n">mail</span><span class="o">=</span><span class="n">Mail</span><span class="p">()</span>
<span class="n">mail</span><span class="o">.</span><span class="n">settings</span><span class="o">.</span><span class="n">server</span><span class="o">=</span><span class="s">&#39;smtp.gmail.com:587&#39;</span>
<span class="n">mail</span><span class="o">.</span><span class="n">settings</span><span class="o">.</span><span class="n">sender</span><span class="o">=</span><span class="s">&#39;you@somewhere.com&#39;</span>
<span class="n">mail</span><span class="o">.</span><span class="n">settings</span><span class="o">.</span><span class="n">login</span><span class="o">=</span><span class="s">&#39;username:password&#39;</span>
<span class="n">auth</span><span class="o">=</span><span class="n">Auth</span><span class="p">(</span><span class="nb">globals</span><span class="p">(),</span> <span class="n">db</span><span class="p">)</span>
<span class="n">auth</span><span class="o">.</span><span class="n">settings</span><span class="o">.</span><span class="n">mailer</span><span class="o">=</span><span class="n">mail</span>
<span class="c"># auth.settings....=...</span>
<span class="n">auth</span><span class="o">.</span><span class="n">define_tables</span><span class="p">()</span>
<span class="k">def</span> <span class="nf">authentication</span><span class="p">():</span> 
    <span class="k">return</span> <span class="nb">dict</span><span class="p">(</span><span class="n">form</span><span class="o">=</span><span class="n">auth</span><span class="p">())</span>
</pre></div>
</div>
<p>exposes:</p>
<ul class="simple">
<li><a class="reference external" href="http://">http://</a>.../{application}/{controller}/authentication/login</li>
<li><a class="reference external" href="http://">http://</a>.../{application}/{controller}/authentication/logout</li>
<li><a class="reference external" href="http://">http://</a>.../{application}/{controller}/authentication/register</li>
<li><a class="reference external" href="http://">http://</a>.../{application}/{controller}/authentication/veryfy_email</li>
<li><a class="reference external" href="http://">http://</a>.../{application}/{controller}/authentication/retrieve_username</li>
<li><a class="reference external" href="http://">http://</a>.../{application}/{controller}/authentication/retrieve_password</li>
<li><a class="reference external" href="http://">http://</a>.../{application}/{controller}/authentication/profile</li>
<li><a class="reference external" href="http://">http://</a>.../{application}/{controller}/authentication/change_password</li>
</ul>
<p>On registration a group with role=new_user.id is created 
and user is given membership of this group.</p>
<p>You can create a group with:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">group_id</span><span class="o">=</span><span class="n">auth</span><span class="o">.</span><span class="n">add_group</span><span class="p">(</span><span class="s">&#39;Manager&#39;</span><span class="p">,</span> <span class="s">&#39;can access the manage action&#39;</span><span class="p">)</span>
<span class="n">auth</span><span class="o">.</span><span class="n">add_permission</span><span class="p">(</span><span class="n">group_id</span><span class="p">,</span> <span class="s">&#39;access to manage&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>Here &#8220;access to manage&#8221; is just a user defined string.
You can give access to a user:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">auth</span><span class="o">.</span><span class="n">add_membership</span><span class="p">(</span><span class="n">group_id</span><span class="p">,</span> <span class="n">user_id</span><span class="p">)</span>
</pre></div>
</div>
<p>If user id is omitted, the logged in user is assumed</p>
<p>Then you can decorate any action:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="nd">@auth</span><span class="o">.</span><span class="n">requires_permission</span><span class="p">(</span><span class="s">&#39;access to manage&#39;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">manage</span><span class="p">():</span>
    <span class="k">return</span> <span class="nb">dict</span><span class="p">()</span>
</pre></div>
</div>
<p>You can restrict a permission to a specific table:</p>
<div class="highlight-python"><pre>auth.add_permission(group_id, 'edit', db.sometable)
@auth.requires_permission('edit', db.sometable)</pre>
</div>
<p>Or to a specific record:</p>
<div class="highlight-python"><pre>auth.add_permission(group_id, 'edit', db.sometable, 45)
@auth.requires_permission('edit', db.sometable,45)</pre>
</div>
<p>If authorization is not granted calls:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">auth</span><span class="o">.</span><span class="n">settings</span><span class="o">.</span><span class="n">on_failed_authorization</span>
</pre></div>
</div>
<p>Other options:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">auth</span><span class="o">.</span><span class="n">settings</span><span class="o">.</span><span class="n">mailer</span><span class="o">=</span><span class="bp">None</span>
<span class="n">auth</span><span class="o">.</span><span class="n">settings</span><span class="o">.</span><span class="n">expiration</span><span class="o">=</span><span class="mf">3600</span> <span class="c"># seconds</span>

<span class="o">...</span>

<span class="c">### these are messages that can be customized</span>
<span class="o">...</span>
</pre></div>
</div>
<dl class="method">
<dt id="gluon.tools.Auth.accessible_query">
<tt class="descname">accessible_query</tt><big>(</big><em>name</em>, <em>table</em>, <em>user_id=None</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.accessible_query" title="Permalink to this definition">¶</a></dt>
<dd><p>returns a query with all accessible records for user_id or 
the current logged in user
this method does not work on GAE because uses JOIN and IN</p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">db</span><span class="p">(</span><span class="n">accessible_query</span><span class="p">(</span><span class="s">&#39;read&#39;</span><span class="p">,</span> <span class="n">db</span><span class="o">.</span><span class="n">mytable</span><span class="p">))</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">db</span><span class="o">.</span><span class="n">mytable</span><span class="o">.</span><span class="n">ALL</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.add_group">
<tt class="descname">add_group</tt><big>(</big><em>role</em>, <em>description=''</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.add_group" title="Permalink to this definition">¶</a></dt>
<dd>creates a group associated to a role</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.add_membership">
<tt class="descname">add_membership</tt><big>(</big><em>group_id</em>, <em>user_id=None</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.add_membership" title="Permalink to this definition">¶</a></dt>
<dd>gives user_id membership of group_id
if group_id==None than user_id is that of current logged in user</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.add_permission">
<tt class="descname">add_permission</tt><big>(</big><em>group_id</em>, <em>name='any'</em>, <em>table_name=''</em>, <em>record_id=0</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.add_permission" title="Permalink to this definition">¶</a></dt>
<dd>gives group_id &#8216;name&#8217; access to &#8216;table_name&#8217; and &#8216;record_id&#8217;</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.basic">
<tt class="descname">basic</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.tools.Auth.basic" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.change_password">
<tt class="descname">change_password</tt><big>(</big><em>next=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onvalidation=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onaccept=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>log=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.change_password" title="Permalink to this definition">¶</a></dt>
<dd><p>returns a form that lets the user change password</p>
<dl class="method">
<dt>
<tt class="descname">Auth.change_password([next=DEFAULT[, onvalidation=DEFAULT[,</tt></dt>
<dt>
<tt class="descname">onaccepet=DEFAULT[, log=DEFAULT]]]])</tt></dt>
<dd></dd></dl>

</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.define_tables">
<tt class="descname">define_tables</tt><big>(</big><em>migrate=True</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.define_tables" title="Permalink to this definition">¶</a></dt>
<dd><p>to be called unless tables are defined manually</p>
<p>usages:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># defines all needed tables and table files UUID+&#39;_auth_user.table&#39;,...</span>
<span class="n">auth</span><span class="o">.</span><span class="n">define_tables</span><span class="p">()</span>

<span class="c"># defines all needed tables and table files &#39;myprefix_auth_user.table&#39;,...</span>
<span class="n">auth</span><span class="o">.</span><span class="n">define_tables</span><span class="p">(</span><span class="n">migrate</span><span class="o">=</span><span class="s">&#39;myprefix_&#39;</span><span class="p">)</span>

<span class="c"># defines all needed tables without migration/table files</span>
<span class="n">auth</span><span class="o">.</span><span class="n">define_tables</span><span class="p">(</span><span class="n">migrate</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>              
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.del_group">
<tt class="descname">del_group</tt><big>(</big><em>group_id</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.del_group" title="Permalink to this definition">¶</a></dt>
<dd>deletes a group</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.del_membership">
<tt class="descname">del_membership</tt><big>(</big><em>group_id</em>, <em>user_id=None</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.del_membership" title="Permalink to this definition">¶</a></dt>
<dd>revokes membership from group_id to user_id
if group_id==None than user_id is that of current logged in user</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.del_permission">
<tt class="descname">del_permission</tt><big>(</big><em>group_id</em>, <em>name='any'</em>, <em>table_name=''</em>, <em>record_id=0</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.del_permission" title="Permalink to this definition">¶</a></dt>
<dd>revokes group_id &#8216;name&#8217; access to &#8216;table_name&#8217; and &#8216;record_id&#8217;</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.get_or_create_user">
<tt class="descname">get_or_create_user</tt><big>(</big><em>keys</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.get_or_create_user" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.groups">
<tt class="descname">groups</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.tools.Auth.groups" title="Permalink to this definition">¶</a></dt>
<dd>displays the groups and their roles for the logged in user</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.has_membership">
<tt class="descname">has_membership</tt><big>(</big><em>group_id</em>, <em>user_id=None</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.has_membership" title="Permalink to this definition">¶</a></dt>
<dd>checks if user is member of group_id</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.has_permission">
<tt class="descname">has_permission</tt><big>(</big><em>name='any'</em>, <em>table_name=''</em>, <em>record_id=0</em>, <em>user_id=None</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.has_permission" title="Permalink to this definition">¶</a></dt>
<dd>checks if user_id or current logged in user is member of a group
that has &#8216;name&#8217; permission on &#8216;table_name&#8217; and &#8216;record_id&#8217;</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.id_group">
<tt class="descname">id_group</tt><big>(</big><em>role</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.id_group" title="Permalink to this definition">¶</a></dt>
<dd>returns the group_id of the group specified by the role</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.impersonate">
<tt class="descname">impersonate</tt><big>(</big><em>user_id=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.impersonate" title="Permalink to this definition">¶</a></dt>
<dd><p>usage: <a class="reference external" href="http://..../impersonate/[user_id">http://..../impersonate/[user_id</a>] 
or:    <a class="reference external" href="http://..../impersonate/0">http://..../impersonate/0</a> to restore impersonator</p>
<p>requires impersonator is logged in and
has_permission(&#8216;impersonate&#8217;,&#8217;auth_user&#8217;,user_id)</p>
</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.is_impersonating">
<tt class="descname">is_impersonating</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.tools.Auth.is_impersonating" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.is_logged_in">
<tt class="descname">is_logged_in</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.tools.Auth.is_logged_in" title="Permalink to this definition">¶</a></dt>
<dd>checks if the user is logged in and returns True/False.
if so user is in auth.user as well as in session.auth.user</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.log_event">
<tt class="descname">log_event</tt><big>(</big><em>description</em>, <em>origin='auth'</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.log_event" title="Permalink to this definition">¶</a></dt>
<dd><p>usage:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">auth</span><span class="o">.</span><span class="n">log_event</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s">&#39;this happened&#39;</span><span class="p">,</span><span class="n">origin</span><span class="o">=</span><span class="s">&#39;auth&#39;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.login">
<tt class="descname">login</tt><big>(</big><em>next=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onvalidation=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onaccept=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>log=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.login" title="Permalink to this definition">¶</a></dt>
<dd><p>returns a login form</p>
<dl class="method">
<dt>
<tt class="descname">Auth.login([next=DEFAULT [, onvalidation=DEFAULT</tt></dt>
<dt>
<tt class="descname">[, onaccept=DEFAULT [, log=DEFAULT]]]])</tt></dt>
<dd></dd></dl>

</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.login_bare">
<tt class="descname">login_bare</tt><big>(</big><em>username</em>, <em>password</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.login_bare" title="Permalink to this definition">¶</a></dt>
<dd>logins user</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.logout">
<tt class="descname">logout</tt><big>(</big><em>next=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onlogout=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>log=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.logout" title="Permalink to this definition">¶</a></dt>
<dd><p>logout and redirects to login</p>
<dl class="method">
<dt>
<tt class="descname">logout</tt><big>(</big><span class="optional">[</span><em>next=DEFAULT</em><span class="optional">[</span>, <em>onlogout=DEFAULT</em><span class="optional">[</span>, <em>log=DEFAULT</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><big>)</big></dt>
<dd></dd></dl>

</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.not_authorized">
<tt class="descname">not_authorized</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.tools.Auth.not_authorized" title="Permalink to this definition">¶</a></dt>
<dd>you can change the view for this page to make it look as you like</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.profile">
<tt class="descname">profile</tt><big>(</big><em>next=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onvalidation=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onaccept=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>log=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.profile" title="Permalink to this definition">¶</a></dt>
<dd><p>returns a form that lets the user change his/her profile</p>
<dl class="method">
<dt>
<tt class="descname">Auth.profile([next=DEFAULT [, onvalidation=DEFAULT</tt></dt>
<dt>
<tt class="descname">[, onaccept=DEFAULT [, log=DEFAULT]]]])</tt></dt>
<dd></dd></dl>

</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.random_password">
<tt class="descname">random_password</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.tools.Auth.random_password" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.register">
<tt class="descname">register</tt><big>(</big><em>next=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onvalidation=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onaccept=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>log=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.register" title="Permalink to this definition">¶</a></dt>
<dd><p>returns a registration form</p>
<dl class="method">
<dt>
<tt class="descname">Auth.register([next=DEFAULT [, onvalidation=DEFAULT</tt></dt>
<dt>
<tt class="descname">[, onaccept=DEFAULT [, log=DEFAULT]]]])</tt></dt>
<dd></dd></dl>

</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.requires">
<tt class="descname">requires</tt><big>(</big><em>condition</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.requires" title="Permalink to this definition">¶</a></dt>
<dd>decorator that prevents access to action if not logged in</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.requires_login">
<tt class="descname">requires_login</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.tools.Auth.requires_login" title="Permalink to this definition">¶</a></dt>
<dd>decorator that prevents access to action if not logged in</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.requires_membership">
<tt class="descname">requires_membership</tt><big>(</big><em>role</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.requires_membership" title="Permalink to this definition">¶</a></dt>
<dd>decorator that prevents access to action if not logged in or
if user logged in is not a member of group_id.
If role is provided instead of group_id then the group_id is calculated.</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.requires_permission">
<tt class="descname">requires_permission</tt><big>(</big><em>name</em>, <em>table_name=''</em>, <em>record_id=0</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.requires_permission" title="Permalink to this definition">¶</a></dt>
<dd>decorator that prevents access to action if not logged in or
if user logged in is not a member of any group (role) that
has &#8216;name&#8217; access to &#8216;table_name&#8217;, &#8216;record_id&#8217;.</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.retrieve_password">
<tt class="descname">retrieve_password</tt><big>(</big><em>next=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onvalidation=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onaccept=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>log=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.retrieve_password" title="Permalink to this definition">¶</a></dt>
<dd><p>returns a form to retrieve the user password</p>
<dl class="method">
<dt>
<tt class="descname">Auth.retrieve_password([next=DEFAULT [, onvalidation=DEFAULT</tt></dt>
<dt>
<tt class="descname">[, onaccept=DEFAULT [, log=DEFAULT]]]])</tt></dt>
<dd></dd></dl>

</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.retrieve_username">
<tt class="descname">retrieve_username</tt><big>(</big><em>next=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onvalidation=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onaccept=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>log=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.retrieve_username" title="Permalink to this definition">¶</a></dt>
<dd><p>returns a form to retrieve the user username
(only if there is a username field)</p>
<dl class="method">
<dt>
<tt class="descname">Auth.retrieve_username([next=DEFAULT [, onvalidation=DEFAULT</tt></dt>
<dt>
<tt class="descname">[, onaccept=DEFAULT [, log=DEFAULT]]]])</tt></dt>
<dd></dd></dl>

</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.url">
<tt class="descname">url</tt><big>(</big><em>f=None</em>, <em>args=</em><span class="optional">[</span><span class="optional">]</span>, <em>vars={}</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.url" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.user_group">
<tt class="descname">user_group</tt><big>(</big><em>user_id=None</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.user_group" title="Permalink to this definition">¶</a></dt>
<dd>returns the group_id of the group uniquely associated to this user
i.e. role=user:[user_id]</dd></dl>

<dl class="method">
<dt id="gluon.tools.Auth.verify_email">
<tt class="descname">verify_email</tt><big>(</big><em>next=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onaccept=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>log=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em><big>)</big><a class="headerlink" href="#gluon.tools.Auth.verify_email" title="Permalink to this definition">¶</a></dt>
<dd><p>action user to verify the registration email, XXXXXXXXXXXXXXXX</p>
<dl class="method">
<dt>
<tt class="descname">Auth.verify_email([next=DEFAULT [, onvalidation=DEFAULT</tt></dt>
<dt>
<tt class="descname">[, onaccept=DEFAULT [, log=DEFAULT]]]])</tt></dt>
<dd></dd></dl>

</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.tools.Recaptcha">
<em class="property">
class </em><tt class="descclassname">gluon.tools.</tt><tt class="descname">Recaptcha</tt><big>(</big><em>request</em>, <em>public_key=''</em>, <em>private_key=''</em>, <em>use_ssl=False</em>, <em>error=None</em>, <em>error_message='invalid'</em><big>)</big><a class="headerlink" href="#gluon.tools.Recaptcha" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></p>
<dl class="method">
<dt id="gluon.tools.Recaptcha.xml">
<tt class="descname">xml</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.tools.Recaptcha.xml" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.tools.Crud">
<em class="property">
class </em><tt class="descclassname">gluon.tools.</tt><tt class="descname">Crud</tt><big>(</big><em>environment</em>, <em>db</em><big>)</big><a class="headerlink" href="#gluon.tools.Crud" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<dl class="method">
<dt id="gluon.tools.Crud.create">
<tt class="descname">create</tt><big>(</big><em>table</em>, <em>next=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onvalidation=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onaccept=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>log=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>message=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em><big>)</big><a class="headerlink" href="#gluon.tools.Crud.create" title="Permalink to this definition">¶</a></dt>
<dd><dl class="method">
<dt>
<tt class="descname">Crud.create(table, [next=DEFAULT [, onvalidation=DEFAULT</tt></dt>
<dt>
<tt class="descname">[, onaccept=DEFAULT [, log=DEFAULT[, message=DEFAULT]]]]])</tt></dt>
<dd></dd></dl>

</dd></dl>

<dl class="method">
<dt id="gluon.tools.Crud.delete">
<tt class="descname">delete</tt><big>(</big><em>table</em>, <em>record_id</em>, <em>next=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>message=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em><big>)</big><a class="headerlink" href="#gluon.tools.Crud.delete" title="Permalink to this definition">¶</a></dt>
<dd><dl class="method">
<dt>
<tt class="descname">delete</tt><big>(</big><em>table</em>, <em>record_id</em><span class="optional">[</span>, <em>next=DEFAULT</em><span class="optional">[</span>, <em>message=DEFAULT</em><span class="optional">]</span><span class="optional">]</span><big>)</big></dt>
<dd></dd></dl>

</dd></dl>

<dl class="method">
<dt id="gluon.tools.Crud.has_permission">
<tt class="descname">has_permission</tt><big>(</big><em>name</em>, <em>table</em>, <em>record=0</em><big>)</big><a class="headerlink" href="#gluon.tools.Crud.has_permission" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Crud.log_event">
<tt class="descname">log_event</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#gluon.tools.Crud.log_event" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Crud.read">
<tt class="descname">read</tt><big>(</big><em>table</em>, <em>record</em><big>)</big><a class="headerlink" href="#gluon.tools.Crud.read" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Crud.select">
<tt class="descname">select</tt><big>(</big><em>table</em>, <em>query=None</em>, <em>fields=None</em>, <em>orderby=None</em>, <em>limitby=None</em>, <em>headers={}</em>, <em>**attr</em><big>)</big><a class="headerlink" href="#gluon.tools.Crud.select" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Crud.tables">
<tt class="descname">tables</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.tools.Crud.tables" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Crud.update">
<tt class="descname">update</tt><big>(</big><em>table</em>, <em>record</em>, <em>next=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onvalidation=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>onaccept=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>ondelete=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>log=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>message=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em>, <em>deletable=&lt;function &lt;lambda&gt; at 0x465d5b0&gt;</em><big>)</big><a class="headerlink" href="#gluon.tools.Crud.update" title="Permalink to this definition">¶</a></dt>
<dd><dl class="method">
<dt>
<tt class="descname">Crud.update(table, record, [next=DEFAULT [, onvalidation=DEFAULT</tt></dt>
<dt>
<tt class="descname">[, onaccept=DEFAULT [, log=DEFAULT[, message=DEFAULT[, deletable=DEFAULT]]]]]])</tt></dt>
<dd></dd></dl>

</dd></dl>

<dl class="method">
<dt id="gluon.tools.Crud.url">
<tt class="descname">url</tt><big>(</big><em>f=None</em>, <em>args=</em><span class="optional">[</span><span class="optional">]</span>, <em>vars={}</em><big>)</big><a class="headerlink" href="#gluon.tools.Crud.url" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.tools.Service">
<em class="property">
class </em><tt class="descclassname">gluon.tools.</tt><tt class="descname">Service</tt><big>(</big><em>environment</em><big>)</big><a class="headerlink" href="#gluon.tools.Service" title="Permalink to this definition">¶</a></dt>
<dd><dl class="method">
<dt id="gluon.tools.Service.amfrpc">
<tt class="descname">amfrpc</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#gluon.tools.Service.amfrpc" title="Permalink to this definition">¶</a></dt>
<dd><p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">service</span> <span class="o">=</span> <span class="n">Service</span><span class="p">(</span><span class="nb">globals</span><span class="p">())</span>
<span class="nd">@service</span><span class="o">.</span><span class="n">amfrpc</span>
<span class="k">def</span> <span class="nf">myfunction</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
    <span class="k">return</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span>
<span class="k">def</span> <span class="nf">call</span><span class="p">():</span> 
    <span class="k">return</span> <span class="n">service</span><span class="p">()</span>
</pre></div>
</div>
<p>The call it with:</p>
<div class="highlight-python"><pre>wget http://..../app/default/call/amfrpc/myfunc?a=hello&amp;b=world</pre>
</div>
</dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.csv">
<tt class="descname">csv</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#gluon.tools.Service.csv" title="Permalink to this definition">¶</a></dt>
<dd><p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">service</span> <span class="o">=</span> <span class="n">Service</span><span class="p">(</span><span class="nb">globals</span><span class="p">())</span>
<span class="nd">@service</span><span class="o">.</span><span class="n">csv</span>
<span class="k">def</span> <span class="nf">myfunction</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
    <span class="k">return</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span>
<span class="k">def</span> <span class="nf">call</span><span class="p">():</span>
    <span class="k">return</span> <span class="n">service</span><span class="p">()</span>
</pre></div>
</div>
<p>Then call it with:</p>
<div class="highlight-python"><pre>wget http://..../app/default/call/csv/myfunc?a=3&amp;b=4</pre>
</div>
</dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.error">
<tt class="descname">error</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.tools.Service.error" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.json">
<tt class="descname">json</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#gluon.tools.Service.json" title="Permalink to this definition">¶</a></dt>
<dd><p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">service</span> <span class="o">=</span> <span class="n">Service</span><span class="p">(</span><span class="nb">globals</span><span class="p">())</span>
<span class="nd">@service</span><span class="o">.</span><span class="n">json</span>
<span class="k">def</span> <span class="nf">myfunction</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
    <span class="k">return</span> <span class="p">[{</span><span class="n">a</span><span class="p">:</span> <span class="n">b</span><span class="p">}]</span>
<span class="k">def</span> <span class="nf">call</span><span class="p">():</span> 
    <span class="k">return</span> <span class="n">service</span><span class="p">()</span>
</pre></div>
</div>
<p>Then call it with:</p>
<div class="highlight-python"><pre>wget http://..../app/default/call/json/myfunc?a=hello&amp;b=world</pre>
</div>
</dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.jsonrpc">
<tt class="descname">jsonrpc</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#gluon.tools.Service.jsonrpc" title="Permalink to this definition">¶</a></dt>
<dd><p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">service</span> <span class="o">=</span> <span class="n">Service</span><span class="p">(</span><span class="nb">globals</span><span class="p">())</span>
<span class="nd">@service</span><span class="o">.</span><span class="n">jsonrpc</span>
<span class="k">def</span> <span class="nf">myfunction</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
    <span class="k">return</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span>
<span class="k">def</span> <span class="nf">call</span><span class="p">():</span> 
    <span class="k">return</span> <span class="n">service</span><span class="p">()</span>
</pre></div>
</div>
<p>Then call it with:</p>
<div class="highlight-python"><pre>wget http://..../app/default/call/jsonrpc/myfunc?a=hello&amp;b=world</pre>
</div>
</dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.rss">
<tt class="descname">rss</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#gluon.tools.Service.rss" title="Permalink to this definition">¶</a></dt>
<dd><p>example:</p>
<div class="highlight-python"><pre>service = Service(globals())
@service.rss
def myfunction():
    return dict(title=...,link=...,description=...,created_on=...,
                entries=[dict(title=...,link=...,description=...,created_on=...])
def call(): 
    return service()</pre>
</div>
<p>Then call it with:</p>
<div class="highlight-python"><pre>wget http://..../app/default/call/rss/myfunc</pre>
</div>
</dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.run">
<tt class="descname">run</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#gluon.tools.Service.run" title="Permalink to this definition">¶</a></dt>
<dd><p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">service</span> <span class="o">=</span> <span class="n">Service</span><span class="p">(</span><span class="nb">globals</span><span class="p">())</span>
<span class="nd">@service</span><span class="o">.</span><span class="n">run</span>
<span class="k">def</span> <span class="nf">myfunction</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
    <span class="k">return</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span>
<span class="k">def</span> <span class="nf">call</span><span class="p">():</span>
    <span class="k">return</span> <span class="n">service</span><span class="p">()</span>
</pre></div>
</div>
<p>Then call it with:</p>
<div class="highlight-python"><pre>wget http://..../app/default/call/run/myfunc?a=3&amp;b=4</pre>
</div>
</dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.serve_amfrpc">
<tt class="descname">serve_amfrpc</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.tools.Service.serve_amfrpc" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.serve_csv">
<tt class="descname">serve_csv</tt><big>(</big><em>args=None</em><big>)</big><a class="headerlink" href="#gluon.tools.Service.serve_csv" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.serve_json">
<tt class="descname">serve_json</tt><big>(</big><em>args=None</em><big>)</big><a class="headerlink" href="#gluon.tools.Service.serve_json" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.serve_jsonrpc">
<tt class="descname">serve_jsonrpc</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.tools.Service.serve_jsonrpc" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.serve_rss">
<tt class="descname">serve_rss</tt><big>(</big><em>args=None</em><big>)</big><a class="headerlink" href="#gluon.tools.Service.serve_rss" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.serve_run">
<tt class="descname">serve_run</tt><big>(</big><em>args=None</em><big>)</big><a class="headerlink" href="#gluon.tools.Service.serve_run" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.serve_xml">
<tt class="descname">serve_xml</tt><big>(</big><em>args=None</em><big>)</big><a class="headerlink" href="#gluon.tools.Service.serve_xml" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.serve_xmlrpc">
<tt class="descname">serve_xmlrpc</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.tools.Service.serve_xmlrpc" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.xml">
<tt class="descname">xml</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#gluon.tools.Service.xml" title="Permalink to this definition">¶</a></dt>
<dd><p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">service</span> <span class="o">=</span> <span class="n">Service</span><span class="p">(</span><span class="nb">globals</span><span class="p">())</span>
<span class="nd">@service</span><span class="o">.</span><span class="n">xml</span>
<span class="k">def</span> <span class="nf">myfunction</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
    <span class="k">return</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span>
<span class="k">def</span> <span class="nf">call</span><span class="p">():</span>
    <span class="k">return</span> <span class="n">service</span><span class="p">()</span>
</pre></div>
</div>
<p>Then call it with:</p>
<div class="highlight-python"><pre>wget http://..../app/default/call/xml/myfunc?a=3&amp;b=4</pre>
</div>
</dd></dl>

<dl class="method">
<dt id="gluon.tools.Service.xmlrpc">
<tt class="descname">xmlrpc</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#gluon.tools.Service.xmlrpc" title="Permalink to this definition">¶</a></dt>
<dd><p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">service</span> <span class="o">=</span> <span class="n">Service</span><span class="p">(</span><span class="nb">globals</span><span class="p">())</span>
<span class="nd">@service</span><span class="o">.</span><span class="n">xmlrpc</span>
<span class="k">def</span> <span class="nf">myfunction</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
    <span class="k">return</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span>
<span class="k">def</span> <span class="nf">call</span><span class="p">():</span> 
    <span class="k">return</span> <span class="n">service</span><span class="p">()</span>
</pre></div>
</div>
<p>The call it with:</p>
<div class="highlight-python"><pre>wget http://..../app/default/call/xmlrpc/myfunc?a=hello&amp;b=world</pre>
</div>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="gluon.tools.fetch">
<tt class="descclassname">gluon.tools.</tt><tt class="descname">fetch</tt><big>(</big><em>url</em><big>)</big><a class="headerlink" href="#gluon.tools.fetch" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="gluon.tools.geocode">
<tt class="descclassname">gluon.tools.</tt><tt class="descname">geocode</tt><big>(</big><em>address</em><big>)</big><a class="headerlink" href="#gluon.tools.geocode" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div>
<div class="section" id="module-gluon.languages">
<h2>The <tt class="xref docutils literal"><span class="pre">languages</span></tt> Module<a class="headerlink" href="#module-gluon.languages" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<dl class="class">
<dt id="gluon.languages.translator">
<em class="property">
class </em><tt class="descclassname">gluon.languages.</tt><tt class="descname">translator</tt><big>(</big><em>request</em><big>)</big><a class="headerlink" href="#gluon.languages.translator" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>this class is instantiated once in gluon/main.py as the T object</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">T</span><span class="o">.</span><span class="n">force</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span> <span class="c"># turns off translation</span>
<span class="n">T</span><span class="o">.</span><span class="n">force</span><span class="p">(</span><span class="s">&#39;fr, it&#39;</span><span class="p">)</span> <span class="c"># forces web2py to translate using fr.py or it.py</span>

<span class="n">T</span><span class="p">(</span><span class="s">&quot;Hello World&quot;</span><span class="p">)</span> <span class="c"># translates &quot;Hello World&quot; using the selected file</span>
</pre></div>
</div>
<p>notice 1: there is no need to force since, by default, T uses accept_langauge
to determine a translation file.</p>
<p>notice 2: en and en-en are considered different languages!</p>
<dl class="method">
<dt id="gluon.languages.translator.force">
<tt class="descname">force</tt><big>(</big><em>languages=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#gluon.languages.translator.force" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.languages.translator.translate">
<tt class="descname">translate</tt><big>(</big><em>message</em>, <em>symbols</em><big>)</big><a class="headerlink" href="#gluon.languages.translator.translate" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="function">
<dt id="gluon.languages.findT">
<tt class="descclassname">gluon.languages.</tt><tt class="descname">findT</tt><big>(</big><em>path</em>, <em>language='en-us'</em><big>)</big><a class="headerlink" href="#gluon.languages.findT" title="Permalink to this definition">¶</a></dt>
<dd>must be run by the admin app</dd></dl>

<dl class="function">
<dt id="gluon.languages.update_all_languages">
<tt class="descclassname">gluon.languages.</tt><tt class="descname">update_all_languages</tt><big>(</big><em>application_path</em><big>)</big><a class="headerlink" href="#gluon.languages.update_all_languages" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div>
<div class="section" id="module-gluon.streamer">
<h2>The <tt class="xref docutils literal"><span class="pre">streamer</span></tt> Module<a class="headerlink" href="#module-gluon.streamer" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<dl class="function">
<dt id="gluon.streamer.stream_file_or_304_or_206">
<tt class="descclassname">gluon.streamer.</tt><tt class="descname">stream_file_or_304_or_206</tt><big>(</big><em>static_file</em>, <em>chunk_size=1000000</em>, <em>request=None</em>, <em>headers={}</em>, <em>error_message='&lt;html&gt;&lt;body&gt;&lt;h1&gt;Invalid request&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;'</em><big>)</big><a class="headerlink" href="#gluon.streamer.stream_file_or_304_or_206" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="gluon.streamer.streamer">
<tt class="descclassname">gluon.streamer.</tt><tt class="descname">streamer</tt><big>(</big><em>file</em>, <em>chunk_size=1000000</em>, <em>bytes=None</em><big>)</big><a class="headerlink" href="#gluon.streamer.streamer" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div>
<div class="section" id="module-gluon.restricted">
<h2>The <tt class="xref docutils literal"><span class="pre">restricted</span></tt> Module<a class="headerlink" href="#module-gluon.restricted" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<dl class="class">
<dt id="gluon.restricted.RestrictedError">
<em class="property">
class </em><tt class="descclassname">gluon.restricted.</tt><tt class="descname">RestrictedError</tt><big>(</big><em>layer=''</em>, <em>code=''</em>, <em>output=''</em>, <em>environment={}</em><big>)</big><a class="headerlink" href="#gluon.restricted.RestrictedError" title="Permalink to this definition">¶</a></dt>
<dd><p>class used to wrap an exception that occurs in the restricted environment
below. the traceback is used to log the exception and generate a ticket.</p>
<dl class="method">
<dt id="gluon.restricted.RestrictedError.load">
<tt class="descname">load</tt><big>(</big><em>request</em>, <em>app</em>, <em>ticket_id</em><big>)</big><a class="headerlink" href="#gluon.restricted.RestrictedError.load" title="Permalink to this definition">¶</a></dt>
<dd>loads a logged exception.</dd></dl>

<dl class="method">
<dt id="gluon.restricted.RestrictedError.log">
<tt class="descname">log</tt><big>(</big><em>request</em><big>)</big><a class="headerlink" href="#gluon.restricted.RestrictedError.log" title="Permalink to this definition">¶</a></dt>
<dd>logs the exception.</dd></dl>

</dd></dl>

<dl class="function">
<dt id="gluon.restricted.restricted">
<tt class="descclassname">gluon.restricted.</tt><tt class="descname">restricted</tt><big>(</big><em>code</em>, <em>environment={}</em>, <em>layer='Unknown'</em><big>)</big><a class="headerlink" href="#gluon.restricted.restricted" title="Permalink to this definition">¶</a></dt>
<dd>runs code in environment and returns the output. if an exception occurs 
in code it raises a RestrictedError containing the traceback. layer is passed
to RestrictedError to identify where the error occurred.</dd></dl>

<dl class="class">
<dt id="gluon.restricted.TicketStorage">
<em class="property">
class </em><tt class="descclassname">gluon.restricted.</tt><tt class="descname">TicketStorage</tt><big>(</big><em>db=None</em>, <em>tablename='web2py_ticket'</em><big>)</big><a class="headerlink" href="#gluon.restricted.TicketStorage" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.storage.Storage" class="reference internal" href="#gluon.storage.Storage"><tt class="xref docutils literal"><span class="pre">gluon.storage.Storage</span></tt></a></p>
<p>defines the ticket object and the default values of its members (None)</p>
<dl class="method">
<dt id="gluon.restricted.TicketStorage.load">
<tt class="descname">load</tt><big>(</big><em>request</em>, <em>app</em>, <em>ticket_id</em><big>)</big><a class="headerlink" href="#gluon.restricted.TicketStorage.load" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.restricted.TicketStorage.store">
<tt class="descname">store</tt><big>(</big><em>request</em>, <em>ticket_id</em>, <em>ticket_data</em><big>)</big><a class="headerlink" href="#gluon.restricted.TicketStorage.store" title="Permalink to this definition">¶</a></dt>
<dd>stores the ticket. It will figure out if this must be on disk or in db</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-gluon.http">
<h2>The <tt class="xref docutils literal"><span class="pre">http</span></tt> Module<a class="headerlink" href="#module-gluon.http" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<dl class="exception">
<dt id="gluon.http.HTTP">
<em class="property">
exception </em><tt class="descclassname">gluon.http.</tt><tt class="descname">HTTP</tt><big>(</big><em>status</em>, <em>body=''</em>, <em>**headers</em><big>)</big><a class="headerlink" href="#gluon.http.HTTP" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/exceptions.html#exceptions.BaseException"><tt class="xref docutils literal"><span class="pre">exceptions.BaseException</span></tt></a></p>
<dl class="method">
<dt id="gluon.http.HTTP.to">
<tt class="descname">to</tt><big>(</big><em>responder</em><big>)</big><a class="headerlink" href="#gluon.http.HTTP.to" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="function">
<dt id="gluon.http.redirect">
<tt class="descclassname">gluon.http.</tt><tt class="descname">redirect</tt><big>(</big><em>location</em>, <em>how=303</em><big>)</big><a class="headerlink" href="#gluon.http.redirect" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div>
<div class="section" id="module-gluon.storage">
<h2>The <tt class="xref docutils literal"><span class="pre">storage</span></tt> Module<a class="headerlink" href="#module-gluon.storage" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<p>Provides:</p>
<ul class="simple">
<li>List; like list but returns None instead of IndexOutOfBounds</li>
<li>Storage; like dictionary allowing also for <cite>obj.foo</cite> for <cite>obj[&#8216;foo&#8217;]</cite></li>
</ul>
<dl class="class">
<dt id="gluon.storage.List">
<em class="property">
class </em><tt class="descclassname">gluon.storage.</tt><tt class="descname">List</tt><a class="headerlink" href="#gluon.storage.List" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#list"><tt class="xref docutils literal"><span class="pre">list</span></tt></a></p>
<p>Like a regular python list but a[i] if i is out of bounds return None
instead of IndexOutOfBounds</p>
</dd></dl>

<dl class="class">
<dt id="gluon.storage.Storage">
<em class="property">
class </em><tt class="descclassname">gluon.storage.</tt><tt class="descname">Storage</tt><a class="headerlink" href="#gluon.storage.Storage" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/stdtypes.html#dict"><tt class="xref docutils literal"><span class="pre">dict</span></tt></a></p>
<p>A Storage object is like a dictionary except <cite>obj.foo</cite> can be used
in addition to <cite>obj[&#8216;foo&#8217;]</cite>.</p>
<blockquote>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">o</span> <span class="o">=</span> <span class="n">Storage</span><span class="p">(</span><span class="n">a</span><span class="o">=</span><span class="mf">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">o</span><span class="o">.</span><span class="n">a</span>
<span class="go">1</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">o</span><span class="p">[</span><span class="s">&#39;a&#39;</span><span class="p">]</span>
<span class="go">1</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">o</span><span class="o">.</span><span class="n">a</span> <span class="o">=</span> <span class="mf">2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">o</span><span class="p">[</span><span class="s">&#39;a&#39;</span><span class="p">]</span>
<span class="go">2</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">del</span> <span class="n">o</span><span class="o">.</span><span class="n">a</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">o</span><span class="o">.</span><span class="n">a</span>
<span class="go">None</span>
</pre></div>
</div>
</blockquote>
</dd></dl>

<dl class="class">
<dt id="gluon.storage.Settings">
<em class="property">
class </em><tt class="descclassname">gluon.storage.</tt><tt class="descname">Settings</tt><a class="headerlink" href="#gluon.storage.Settings" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.storage.Storage" class="reference internal" href="#gluon.storage.Storage"><tt class="xref docutils literal"><span class="pre">gluon.storage.Storage</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.storage.Messages">
<em class="property">
class </em><tt class="descclassname">gluon.storage.</tt><tt class="descname">Messages</tt><big>(</big><em>T</em><big>)</big><a class="headerlink" href="#gluon.storage.Messages" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.storage.Storage" class="reference internal" href="#gluon.storage.Storage"><tt class="xref docutils literal"><span class="pre">gluon.storage.Storage</span></tt></a></dd></dl>

<dl class="function">
<dt id="gluon.storage.load_storage">
<tt class="descclassname">gluon.storage.</tt><tt class="descname">load_storage</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#gluon.storage.load_storage" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="gluon.storage.save_storage">
<tt class="descclassname">gluon.storage.</tt><tt class="descname">save_storage</tt><big>(</big><em>storage</em>, <em>filename</em><big>)</big><a class="headerlink" href="#gluon.storage.save_storage" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div>
<div class="section" id="module-gluon.highlight">
<h2>The <tt class="xref docutils literal"><span class="pre">highlight</span></tt> Module<a class="headerlink" href="#module-gluon.highlight" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<dl class="function">
<dt id="gluon.highlight.highlight">
<tt class="descclassname">gluon.highlight.</tt><tt class="descname">highlight</tt><big>(</big><em>code</em>, <em>language</em>, <em>link='/examples/globals/vars/'</em>, <em>counter=1</em>, <em>styles={}</em>, <em>attributes={}</em><big>)</big><a class="headerlink" href="#gluon.highlight.highlight" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div>
<div class="section" id="module-gluon.cache">
<h2>The <tt class="xref docutils literal"><span class="pre">cache</span></tt> Module<a class="headerlink" href="#module-gluon.cache" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<div class="section" id="basic-caching-classes-and-methods">
<h3>Basic caching classes and methods<a class="headerlink" href="#basic-caching-classes-and-methods" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li>Cache - The generic caching object interfacing with the others</li>
<li>CacheInRam - providing caching in ram</li>
<li>CacheInDisk - provides caches on disk</li>
</ul>
<p>Memcache is also available via a different module (see gluon.contrib.memcache)</p>
<p>When web2py is running on Google App Engine,
caching will be provided by the GAE memcache
(see gluon.contrib.gae_memcache)</p>
<dl class="class">
<dt id="gluon.cache.Cache">
<em class="property">
class </em><tt class="descclassname">gluon.cache.</tt><tt class="descname">Cache</tt><big>(</big><em>request</em><big>)</big><a class="headerlink" href="#gluon.cache.Cache" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>Sets up generic caching, creating an instance of both CacheInRam and CacheOnDisk.
In case of GAE will make use of gluon.contrib.gae_memcache</p>
<ul class="simple">
<li>self.ram is an instance of CacheInRam</li>
<li>self.disk is an instance of CacheOnDisk</li>
</ul>
</dd></dl>

</div>
</div>
<div class="section" id="module-gluon.sanitizer">
<h2>The <tt class="xref docutils literal"><span class="pre">sanitizer</span></tt> Module<a class="headerlink" href="#module-gluon.sanitizer" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496942</span>
<span class="c"># Title: Cross-site scripting (XSS) defense</span>
<span class="c"># Submitter: Josh Goldfoot (other recipes)</span>
<span class="c"># Last Updated: 2006/08/05</span>
<span class="c"># Version no: 1.0</span>
</pre></div>
</div>
<dl class="function">
<dt id="gluon.sanitizer.sanitize">
<tt class="descclassname">gluon.sanitizer.</tt><tt class="descname">sanitize</tt><big>(</big><em>text</em>, <em>permitted_tags=</em><span class="optional">[</span>, <em>'a'</em>, <em>'b'</em>, <em>'blockquote'</em>, <em>'br/'</em>, <em>'i'</em>, <em>'li'</em>, <em>'ol'</em>, <em>'ul'</em>, <em>'p'</em>, <em>'cite'</em>, <em>'code'</em>, <em>'pre'</em>, <em>'img/'</em><span class="optional">]</span>, <em>allowed_attributes={'a':</em><span class="optional">[</span>, <em>'href'</em>, <em>'title'</em><span class="optional">]</span>, <em>'blockquote':</em><span class="optional">[</span>, <em>'type'</em><span class="optional">]</span>, <em>'img':</em><span class="optional">[</span>, <em>'src'</em>, <em>'alt'</em><span class="optional">]</span>, <em>}</em><big>)</big><a class="headerlink" href="#gluon.sanitizer.sanitize" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div>
<div class="section" id="module-gluon.main">
<h2>The <tt class="xref docutils literal"><span class="pre">main</span></tt> Module<a class="headerlink" href="#module-gluon.main" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<p>Contains:</p>
<ul class="simple">
<li>wsgibase: the gluon wsgi application</li>
</ul>
<dl class="function">
<dt id="gluon.main.wsgibase">
<tt class="descclassname">gluon.main.</tt><tt class="descname">wsgibase</tt><big>(</big><em>environ</em>, <em>responder</em><big>)</big><a class="headerlink" href="#gluon.main.wsgibase" title="Permalink to this definition">¶</a></dt>
<dd><p>this is the gluon wsgi application. the first function called when a page
is requested (static or dynamic). it can be called by paste.httpserver
or by apache mod_wsgi.</p>
<ul class="simple">
<li>fills request with info<ul>
<li>the environment variables, replacing &#8216;.&#8217; with &#8216;_&#8217;</li>
<li>adds web2py path and version info</li>
<li>compensates for fcgi missing path_info and query_string</li>
</ul>
</li>
<li>validates the path in url</li>
</ul>
<p>The url path must be either:</p>
<ol class="arabic simple">
<li>for static pages:</li>
</ol>
<blockquote>
<ul class="simple">
<li>/&lt;application&gt;/static/&lt;file&gt;</li>
</ul>
</blockquote>
<ol class="arabic simple" start="2">
<li>for dynamic pages:</li>
</ol>
<blockquote>
<ul>
<li><p class="first">/&lt;application&gt;[/&lt;controller&gt;[/&lt;function&gt;[/&lt;sub&gt;]]][.&lt;extension&gt;]</p>
</li>
<li><dl class="first docutils">
<dt>(sub may go several levels deep, currently 3 levels are supported:</dt>
<dd><p class="first last">sub1/sub2/sub3)</p>
</dd>
</dl>
</li>
</ul>
</blockquote>
<p>The naming conventions are:</p>
<ul class="simple">
<li>application, controller, function and extension may only contain [<a href="#id5"><span class="problematic" id="id6">a-zA-Z0-9_</span></a>]</li>
<li>file and sub may also contain &#8216;-&#8216;, &#8216;=&#8217;, &#8216;.&#8217; and &#8216;/&#8217;</li>
</ul>
</dd></dl>

<dl class="function">
<dt id="gluon.main.save_password">
<tt class="descclassname">gluon.main.</tt><tt class="descname">save_password</tt><big>(</big><em>password</em>, <em>port</em><big>)</big><a class="headerlink" href="#gluon.main.save_password" title="Permalink to this definition">¶</a></dt>
<dd>used by main() to save the password in the parameters.py file.</dd></dl>

<dl class="function">
<dt id="gluon.main.appfactory">
<tt class="descclassname">gluon.main.</tt><tt class="descname">appfactory</tt><big>(</big><em>wsgiapp=&lt;function wsgibase at 0x30ff5f0&gt;</em>, <em>logfilename='httpsever.log'</em>, <em>profilerfilename='profiler.log'</em>, <em>web2py_path='/Users/mdipierro/web2py'</em><big>)</big><a class="headerlink" href="#gluon.main.appfactory" title="Permalink to this definition">¶</a></dt>
<dd><p>generates a wsgi application that does logging and profiling and calls
wsgibase</p>
<dl class="function">
<dt>
<tt class="descname">gluon.main.appfactory(</tt></dt>
<dt>
<tt class="descname">[wsgiapp=wsgibase</tt></dt>
<dt>
<tt class="descname">[, logfilename='httpsever.log'</tt></dt>
<dt>
<tt class="descname">[, profilerfilename='profiler.log'</tt></dt>
<dt>
<tt class="descname">[, web2py_path=web2py_path]]]])</tt></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.main.HttpServer">
<em class="property">
class </em><tt class="descclassname">gluon.main.</tt><tt class="descname">HttpServer</tt><big>(</big><em>ip='127.0.0.1'</em>, <em>port=8000</em>, <em>password=''</em>, <em>pid_filename='httpserver.pid'</em>, <em>log_filename='httpserver.log'</em>, <em>profiler_filename=None</em>, <em>ssl_certificate=None</em>, <em>ssl_private_key=None</em>, <em>numthreads=10</em>, <em>server_name=None</em>, <em>request_queue_size=5</em>, <em>timeout=10</em>, <em>shutdown_timeout=5</em>, <em>path='/Users/mdipierro/web2py'</em><big>)</big><a class="headerlink" href="#gluon.main.HttpServer" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>the web2py web server (wsgiserver)</p>
<dl class="method">
<dt id="gluon.main.HttpServer.start">
<tt class="descname">start</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.main.HttpServer.start" title="Permalink to this definition">¶</a></dt>
<dd>start the web server</dd></dl>

<dl class="method">
<dt id="gluon.main.HttpServer.stop">
<tt class="descname">stop</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.main.HttpServer.stop" title="Permalink to this definition">¶</a></dt>
<dd>stop the web server</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-gluon.widget">
<h2>The <tt class="xref docutils literal"><span class="pre">widget</span></tt> Module<a class="headerlink" href="#module-gluon.widget" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<p>The widget is called from web2py.</p>
<dl class="class">
<dt id="gluon.widget.IO">
<em class="property">
class </em><tt class="descclassname">gluon.widget.</tt><tt class="descname">IO</tt><a class="headerlink" href="#gluon.widget.IO" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<dl class="method">
<dt id="gluon.widget.IO.write">
<tt class="descname">write</tt><big>(</big><em>data</em><big>)</big><a class="headerlink" href="#gluon.widget.IO.write" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="function">
<dt id="gluon.widget.console">
<tt class="descclassname">gluon.widget.</tt><tt class="descname">console</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.widget.console" title="Permalink to this definition">¶</a></dt>
<dd>Defines the behaviour of the console web2py execution</dd></dl>

<dl class="function">
<dt id="gluon.widget.presentation">
<tt class="descclassname">gluon.widget.</tt><tt class="descname">presentation</tt><big>(</big><em>root</em><big>)</big><a class="headerlink" href="#gluon.widget.presentation" title="Permalink to this definition">¶</a></dt>
<dd>Draw the splash screen</dd></dl>

<dl class="function">
<dt id="gluon.widget.start">
<tt class="descclassname">gluon.widget.</tt><tt class="descname">start</tt><big>(</big><em>cron=True</em><big>)</big><a class="headerlink" href="#gluon.widget.start" title="Permalink to this definition">¶</a></dt>
<dd>Start server</dd></dl>

<dl class="function">
<dt id="gluon.widget.start_browser">
<tt class="descclassname">gluon.widget.</tt><tt class="descname">start_browser</tt><big>(</big><em>ip</em>, <em>port</em><big>)</big><a class="headerlink" href="#gluon.widget.start_browser" title="Permalink to this definition">¶</a></dt>
<dd>Starts the default browser</dd></dl>

<dl class="function">
<dt id="gluon.widget.try_start_browser">
<tt class="descclassname">gluon.widget.</tt><tt class="descname">try_start_browser</tt><big>(</big><em>url</em><big>)</big><a class="headerlink" href="#gluon.widget.try_start_browser" title="Permalink to this definition">¶</a></dt>
<dd>Try to start the default browser</dd></dl>

<dl class="class">
<dt id="gluon.widget.web2pyDialog">
<em class="property">
class </em><tt class="descclassname">gluon.widget.</tt><tt class="descname">web2pyDialog</tt><big>(</big><em>root</em>, <em>options</em><big>)</big><a class="headerlink" href="#gluon.widget.web2pyDialog" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<p>Main window dialog</p>
<dl class="method">
<dt id="gluon.widget.web2pyDialog.checkTaskBar">
<tt class="descname">checkTaskBar</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.widget.web2pyDialog.checkTaskBar" title="Permalink to this definition">¶</a></dt>
<dd>Check taskbar status</dd></dl>

<dl class="method">
<dt id="gluon.widget.web2pyDialog.connect_pages">
<tt class="descname">connect_pages</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.widget.web2pyDialog.connect_pages" title="Permalink to this definition">¶</a></dt>
<dd>Connect pages</dd></dl>

<dl class="method">
<dt id="gluon.widget.web2pyDialog.error">
<tt class="descname">error</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#gluon.widget.web2pyDialog.error" title="Permalink to this definition">¶</a></dt>
<dd>Show error message</dd></dl>

<dl class="method">
<dt id="gluon.widget.web2pyDialog.quit">
<tt class="descname">quit</tt><big>(</big><em>justHide=False</em><big>)</big><a class="headerlink" href="#gluon.widget.web2pyDialog.quit" title="Permalink to this definition">¶</a></dt>
<dd>Finish the program execution</dd></dl>

<dl class="method">
<dt id="gluon.widget.web2pyDialog.start">
<tt class="descname">start</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.widget.web2pyDialog.start" title="Permalink to this definition">¶</a></dt>
<dd>Start web2py server</dd></dl>

<dl class="method">
<dt id="gluon.widget.web2pyDialog.stop">
<tt class="descname">stop</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.widget.web2pyDialog.stop" title="Permalink to this definition">¶</a></dt>
<dd>Stop web2py server</dd></dl>

<dl class="method">
<dt id="gluon.widget.web2pyDialog.update">
<tt class="descname">update</tt><big>(</big><em>text</em><big>)</big><a class="headerlink" href="#gluon.widget.web2pyDialog.update" title="Permalink to this definition">¶</a></dt>
<dd>Update app text</dd></dl>

<dl class="method">
<dt id="gluon.widget.web2pyDialog.update_canvas">
<tt class="descname">update_canvas</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.widget.web2pyDialog.update_canvas" title="Permalink to this definition">¶</a></dt>
<dd>Update canvas</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-gluon.rewrite">
<h2>The <tt class="xref docutils literal"><span class="pre">rewrite</span></tt> Module<a class="headerlink" href="#module-gluon.rewrite" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<dl class="function">
<dt id="gluon.rewrite.rewrite">
<tt class="descclassname">gluon.rewrite.</tt><tt class="descname">rewrite</tt><big>(</big><em>wsgibase</em>, <em>URL</em><big>)</big><a class="headerlink" href="#gluon.rewrite.rewrite" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div>
<div class="section" id="module-gluon.html">
<h2>The <tt class="xref docutils literal"><span class="pre">html</span></tt> Module<a class="headerlink" href="#module-gluon.html" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<dl class="class">
<dt id="gluon.html.A">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">A</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.A" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.B">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">B</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.B" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.BEAUTIFY">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">BEAUTIFY</tt><big>(</big><em>component</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.BEAUTIFY" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">BEAUTIFY</span><span class="p">([</span><span class="s">&#39;a&#39;</span><span class="p">,</span> <span class="s">&#39;b&#39;</span><span class="p">,</span> <span class="p">{</span><span class="s">&#39;hello&#39;</span><span class="p">:</span> <span class="s">&#39;world&#39;</span><span class="p">}])</span><span class="o">.</span><span class="n">xml</span><span class="p">()</span>
<span class="go">&#39;&lt;div&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;div&gt;a&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div&gt;b&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;&lt;div&gt;hello&lt;/div&gt;&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;top&quot;&gt;:&lt;/td&gt;&lt;td&gt;&lt;div&gt;world&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&#39;</span>
</pre></div>
</div>
<p>turns any list, dictionarie, etc into decent looking html.</p>
</dd></dl>

<dl class="class">
<dt id="gluon.html.BODY">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">BODY</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.BODY" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.BR">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">BR</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.BR" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.CENTER">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">CENTER</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.CENTER" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.CODE">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">CODE</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.CODE" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></p>
<p>displays code in HTML with syntax highlighting.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>attributes</em> &#8211; <p>optional attributes:</p>
<ul class="simple">
<li>language: indicates the language, otherwise PYTHON is assumed</li>
<li>link: can provide a link</li>
<li>styles: for styles</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Example:</p>
<div class="highlight-python"><pre>{{=CODE("print 'hello world'", language='python', link=None, counter=1, styles={})}}</pre>
</div>
<p>supported languages are &#8220;python&#8221;, &#8220;html_plain&#8221;, &#8220;c&#8221;, &#8220;cpp&#8221;, &#8220;web2py&#8221;, &#8220;html&#8221;. 
The &#8220;html&#8221; language interprets {{ and }} tags as &#8220;web2py&#8221; code, &#8220;html_plain&#8221; doesn&#8217;t.</p>
<p>if a link=&#8217;/examples/global/vars/&#8217; is provided web2py keywords are linked to the online docs.
the counter is used for line numbering, counter can be None or a prompt string.</p>
<dl class="method">
<dt id="gluon.html.CODE.xml">
<tt class="descname">xml</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.html.CODE.xml" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.html.DIV">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">DIV</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.DIV" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.html.XmlComponent</span></tt></p>
<p>HTML helper, for easy generating and manipulating a DOM structure.
Little or no validation is done.</p>
<p>Behaves like a dictionary regarding updating of attributes.
Behaves like a list regarding inserting/appending components.</p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">DIV</span><span class="p">(</span><span class="s">&#39;hello&#39;</span><span class="p">,</span><span class="s">&#39;world&#39;</span><span class="p">,</span><span class="n">_style</span><span class="o">=</span><span class="s">&#39;color:red;&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">xml</span><span class="p">()</span> 
<span class="go">&#39;&lt;div style=&quot;color:red;&quot;&gt;helloworld&lt;/div&gt;&#39;</span>
</pre></div>
</div>
<p>all other HTML helpers are derived from DIV.</p>
<p>_something=&#8221;value&#8221; attributes are transparently translated into
something=&#8221;value&#8221; HTML attributes</p>
<dl class="method">
<dt id="gluon.html.DIV.append">
<tt class="descname">append</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#gluon.html.DIV.append" title="Permalink to this definition">¶</a></dt>
<dd>list style appending of components</dd></dl>

<dl class="method">
<dt id="gluon.html.DIV.element">
<tt class="descname">element</tt><big>(</big><em>**kargs</em><big>)</big><a class="headerlink" href="#gluon.html.DIV.element" title="Permalink to this definition">¶</a></dt>
<dd><p>find the first component that matches the supplied attribute dictionary,
or None if nothing could be found</p>
<p>Also the components of the components are searched.</p>
</dd></dl>

<dl class="method">
<dt id="gluon.html.DIV.insert">
<tt class="descname">insert</tt><big>(</big><em>i</em>, <em>value</em><big>)</big><a class="headerlink" href="#gluon.html.DIV.insert" title="Permalink to this definition">¶</a></dt>
<dd>list style inserting of components</dd></dl>

<dl class="method">
<dt id="gluon.html.DIV.update">
<tt class="descname">update</tt><big>(</big><em>**kargs</em><big>)</big><a class="headerlink" href="#gluon.html.DIV.update" title="Permalink to this definition">¶</a></dt>
<dd>dictionary like updating of the tag attributes</dd></dl>

<dl class="method">
<dt id="gluon.html.DIV.xml">
<tt class="descname">xml</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.html.DIV.xml" title="Permalink to this definition">¶</a></dt>
<dd>generates the xml for this component.</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.html.EM">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">EM</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.EM" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.EMBED">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">EMBED</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.EMBED" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.FIELDSET">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">FIELDSET</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.FIELDSET" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.FORM">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">FORM</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.FORM" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">form</span><span class="o">=</span><span class="n">FORM</span><span class="p">(</span><span class="n">INPUT</span><span class="p">(</span><span class="n">_name</span><span class="o">=</span><span class="s">&quot;test&quot;</span><span class="p">,</span><span class="n">requires</span><span class="o">=</span><span class="n">IS_NOT_EMPTY</span><span class="p">()))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">form</span><span class="o">.</span><span class="n">xml</span><span class="p">()</span>
<span class="go">&#39;&lt;form action=&quot;&quot; enctype=&quot;multipart/form-data&quot; method=&quot;post&quot;&gt;&lt;input name=&quot;test&quot; type=&quot;text&quot; /&gt;&lt;/form&gt;&#39;</span>
</pre></div>
</div>
<p>a FORM is container for INPUT, TEXTAREA, SELECT and other helpers</p>
<p>form has one important method:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">form</span><span class="o">.</span><span class="n">accepts</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">vars</span><span class="p">,</span> <span class="n">session</span><span class="p">)</span>
</pre></div>
</div>
<p>if form is accepted (and all validators pass) form.vars contains the
accepted vars, otherwise form.errors contains the errors. 
in case of errors the form is modified to present the errors to the user.</p>
<dl class="method">
<dt id="gluon.html.FORM.accepts">
<tt class="descname">accepts</tt><big>(</big><em>vars</em>, <em>session=None</em>, <em>formname='default'</em>, <em>keepvalues=False</em>, <em>onvalidation=None</em><big>)</big><a class="headerlink" href="#gluon.html.FORM.accepts" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.html.FORM.hidden_fields">
<tt class="descname">hidden_fields</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.html.FORM.hidden_fields" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.html.FORM.xml">
<tt class="descname">xml</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.html.FORM.xml" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.html.H1">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">H1</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.H1" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.H2">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">H2</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.H2" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.H3">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">H3</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.H3" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.H4">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">H4</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.H4" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.H5">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">H5</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.H5" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.H6">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">H6</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.H6" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.HEAD">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">HEAD</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.HEAD" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.HR">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">HR</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.HR" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.HTML">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">HTML</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.HTML" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></p>
<p>HTML:  Will provide a doctype on xml()</p>
<p>You can override the default doctype by supplying the &#8216;doctype&#8217; attribute</p>
<p>see also <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">DIV</span></tt></a></p>
<dl class="method">
<dt id="gluon.html.HTML.xml">
<tt class="descname">xml</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.html.HTML.xml" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.html.IFRAME">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">IFRAME</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.IFRAME" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.IMG">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">IMG</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.IMG" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.INPUT">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">INPUT</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.INPUT" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></p>
<p>INPUT Component</p>
<p>examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;text&#39;</span><span class="p">,</span><span class="n">_name</span><span class="o">=</span><span class="s">&#39;name&#39;</span><span class="p">,</span><span class="n">value</span><span class="o">=</span><span class="s">&#39;Max&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">xml</span><span class="p">()</span>
<span class="go">&#39;&lt;input name=&quot;name&quot; type=&quot;text&quot; value=&quot;Max&quot; /&gt;&#39;</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;checkbox&#39;</span><span class="p">,</span><span class="n">_name</span><span class="o">=</span><span class="s">&#39;checkbox&#39;</span><span class="p">,</span><span class="n">value</span><span class="o">=</span><span class="s">&#39;on&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">xml</span><span class="p">()</span>
<span class="go">&#39;&lt;input checked=&quot;checked&quot; name=&quot;checkbox&quot; type=&quot;checkbox&quot; value=&quot;on&quot; /&gt;&#39;</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;radio&#39;</span><span class="p">,</span><span class="n">_name</span><span class="o">=</span><span class="s">&#39;radio&#39;</span><span class="p">,</span><span class="n">_value</span><span class="o">=</span><span class="s">&#39;yes&#39;</span><span class="p">,</span><span class="n">value</span><span class="o">=</span><span class="s">&#39;yes&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">xml</span><span class="p">()</span>
<span class="go">&#39;&lt;input checked=&quot;checked&quot; name=&quot;radio&quot; type=&quot;radio&quot; value=&quot;yes&quot; /&gt;&#39;</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">INPUT</span><span class="p">(</span><span class="n">_type</span><span class="o">=</span><span class="s">&#39;radio&#39;</span><span class="p">,</span><span class="n">_name</span><span class="o">=</span><span class="s">&#39;radio&#39;</span><span class="p">,</span><span class="n">_value</span><span class="o">=</span><span class="s">&#39;no&#39;</span><span class="p">,</span><span class="n">value</span><span class="o">=</span><span class="s">&#39;yes&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">xml</span><span class="p">()</span>
<span class="go">&#39;&lt;input name=&quot;radio&quot; type=&quot;radio&quot; value=&quot;no&quot; /&gt;&#39;</span>
</pre></div>
</div>
<p>the input helper takes two special attributes value= and requires=.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>value</em> &#8211; <p>used to pass the initial value for the input field.
value differs from _value because it works for checkboxes, radio,
textarea and select/option too.</p>
<ul>
<li>for a checkbox value should be &#8216;&#8217; or &#8216;on&#8217;.</li>
<li><dl class="first docutils">
<dt>for a radio or select/option value should be the _value </dt>
<dd>of the checked/selected item.</dd>
</dl>
</li>
</ul>
</li>
<li><em>requires</em> &#8211; should be None, or a validator or a list of validators for the
value of the field.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="gluon.html.INPUT.xml">
<tt class="descname">xml</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.html.INPUT.xml" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.html.LABEL">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">LABEL</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.LABEL" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.LEGEND">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">LEGEND</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.LEGEND" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.LI">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">LI</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.LI" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.LINK">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">LINK</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.LINK" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.OL">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">OL</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.OL" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.UL" class="reference internal" href="#gluon.html.UL"><tt class="xref docutils literal"><span class="pre">gluon.html.UL</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.UL">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">UL</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.UL" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></p>
<p>UL Component.</p>
<p>If subcomponents are not LI-components they will be wrapped in a LI</p>
<p>see also <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">DIV</span></tt></a></p>
</dd></dl>

<dl class="class">
<dt id="gluon.html.MENU">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">MENU</tt><big>(</big><em>data</em>, <em>**args</em><big>)</big><a class="headerlink" href="#gluon.html.MENU" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></p>
<p>Used to build menus</p>
<dl class="docutils">
<dt>Optional arguments</dt>
<dd>_class: defaults to &#8216;web2py-menu web2py-menu-vertical&#8217;
ul_class: defaults to &#8216;web2py-menu-vertical&#8217;
li_class: defaults to &#8216;web2py-menu-expand&#8217;</dd>
<dt>Example:</dt>
<dd>menu = MENU([[&#8216;name&#8217;, False, URL(...), [submenu]], ...])
{{=menu}}</dd>
</dl>
<dl class="method">
<dt id="gluon.html.MENU.serialize">
<tt class="descname">serialize</tt><big>(</big><em>data</em>, <em>level=0</em><big>)</big><a class="headerlink" href="#gluon.html.MENU.serialize" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="gluon.html.MENU.xml">
<tt class="descname">xml</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.html.MENU.xml" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.html.META">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">META</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.META" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.OBJECT">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">OBJECT</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.OBJECT" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.OPTION">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">OPTION</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.OPTION" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.P">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">P</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.P" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></p>
<p>Will replace <tt class="docutils literal"><span class="pre">\n</span></tt> by <tt class="docutils literal"><span class="pre">&lt;br</span> <span class="pre">/&gt;</span></tt> if the <cite>cr2br</cite> attribute is provided.</p>
<p>see also <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">DIV</span></tt></a></p>
<dl class="method">
<dt id="gluon.html.P.xml">
<tt class="descname">xml</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.html.P.xml" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.html.PRE">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">PRE</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.PRE" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.SCRIPT">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">SCRIPT</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.SCRIPT" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></p>
<dl class="method">
<dt id="gluon.html.SCRIPT.xml">
<tt class="descname">xml</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.html.SCRIPT.xml" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="gluon.html.SELECT">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">SELECT</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.SELECT" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.INPUT" class="reference internal" href="#gluon.html.INPUT"><tt class="xref docutils literal"><span class="pre">gluon.html.INPUT</span></tt></a></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">SELECT</span><span class="p">(</span><span class="s">&#39;yes&#39;</span><span class="p">,</span> <span class="s">&#39;no&#39;</span><span class="p">,</span> <span class="n">_name</span><span class="o">=</span><span class="s">&#39;selector&#39;</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="s">&#39;yes&#39;</span><span class="p">,</span>
<span class="gp">... </span>   <span class="n">requires</span><span class="o">=</span><span class="n">IS_IN_SET</span><span class="p">([</span><span class="s">&#39;yes&#39;</span><span class="p">,</span> <span class="s">&#39;no&#39;</span><span class="p">]))</span><span class="o">.</span><span class="n">xml</span><span class="p">()</span>
<span class="go">&#39;&lt;select name=&quot;selector&quot;&gt;&lt;option selected=&quot;selected&quot; value=&quot;yes&quot;&gt;yes&lt;/option&gt;&lt;option value=&quot;no&quot;&gt;no&lt;/option&gt;&lt;/select&gt;&#39;</span>
</pre></div>
</div>
</dd></dl>

<dl class="class">
<dt id="gluon.html.SPAN">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">SPAN</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.SPAN" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.STYLE">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">STYLE</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.STYLE" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.SCRIPT" class="reference internal" href="#gluon.html.SCRIPT"><tt class="xref docutils literal"><span class="pre">gluon.html.SCRIPT</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.TABLE">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">TABLE</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.TABLE" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></p>
<p>TABLE Component.</p>
<p>If subcomponents are not TR/TBODY/THEAD/TFOOT-components 
they will be wrapped in a TR</p>
<p>see also <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">DIV</span></tt></a></p>
</dd></dl>

<dl class="attribute">
<dt id="gluon.html.TAG">
<tt class="descclassname">gluon.html.</tt><tt class="descname">TAG</tt><a class="headerlink" href="#gluon.html.TAG" title="Permalink to this definition">¶</a></dt>
<dd><p>TAG factory example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">TAG</span><span class="o">.</span><span class="n">first</span><span class="p">(</span><span class="n">TAG</span><span class="o">.</span><span class="n">second</span><span class="p">(</span><span class="s">&#39;test&#39;</span><span class="p">),</span> <span class="n">_key</span> <span class="o">=</span> <span class="mf">3</span><span class="p">)</span>
<span class="go">&lt;first key=&quot;3&quot;&gt;&lt;second&gt;test&lt;/second&gt;&lt;/first&gt;</span>
</pre></div>
</div>
</dd></dl>

<dl class="class">
<dt id="gluon.html.TD">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">TD</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.TD" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.TEXTAREA">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">TEXTAREA</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.TEXTAREA" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.INPUT" class="reference internal" href="#gluon.html.INPUT"><tt class="xref docutils literal"><span class="pre">gluon.html.INPUT</span></tt></a></p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">TEXTAREA</span><span class="p">(</span><span class="n">_name</span><span class="o">=</span><span class="s">&#39;sometext&#39;</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="s">&#39;bla &#39;</span><span class="o">*</span><span class="mf">100</span><span class="p">,</span> <span class="n">requires</span><span class="o">=</span><span class="n">IS_NOT_EMPTY</span><span class="p">())</span>
</pre></div>
</div>
<p>&#8216;bla bla bla ...&#8217; will be the content of the textarea field.</p>
</dd></dl>

<dl class="class">
<dt id="gluon.html.TH">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">TH</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.TH" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.THEAD">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">THEAD</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.THEAD" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.TBODY">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">TBODY</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.TBODY" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.TFOOT">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">TFOOT</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.TFOOT" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.TITLE">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">TITLE</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.TITLE" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="class">
<dt id="gluon.html.TR">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">TR</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.TR" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></p>
<p>TR Component.</p>
<p>If subcomponents are not TD/TH-components they will be wrapped in a TD</p>
<p>see also <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">DIV</span></tt></a></p>
</dd></dl>

<dl class="class">
<dt id="gluon.html.TT">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">TT</tt><big>(</big><em>*components</em>, <em>**attributes</em><big>)</big><a class="headerlink" href="#gluon.html.TT" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="gluon.html.DIV" class="reference internal" href="#gluon.html.DIV"><tt class="xref docutils literal"><span class="pre">gluon.html.DIV</span></tt></a></dd></dl>

<dl class="function">
<dt id="gluon.html.URL">
<tt class="descclassname">gluon.html.</tt><tt class="descname">URL</tt><big>(</big><em>a=None</em>, <em>c=None</em>, <em>f=None</em>, <em>r=None</em>, <em>args=</em><span class="optional">[</span><span class="optional">]</span>, <em>vars={}</em>, <em>anchor=''</em><big>)</big><a class="headerlink" href="#gluon.html.URL" title="Permalink to this definition">¶</a></dt>
<dd><p>generate a relative URL</p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="n">a</span><span class="o">=</span><span class="s">&#39;a&#39;</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="s">&#39;c&#39;</span><span class="p">,</span> <span class="n">f</span><span class="o">=</span><span class="s">&#39;f&#39;</span><span class="p">,</span> <span class="n">args</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">,</span> <span class="s">&#39;y&#39;</span><span class="p">,</span> <span class="s">&#39;z&#39;</span><span class="p">],</span> 
<span class="gp">... </span>    <span class="nb">vars</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;p&#39;</span><span class="p">:</span><span class="mf">1</span><span class="p">,</span> <span class="s">&#39;q&#39;</span><span class="p">:</span><span class="mf">2</span><span class="p">},</span> <span class="n">anchor</span><span class="o">=</span><span class="s">&#39;1&#39;</span><span class="p">)</span>
<span class="go">&#39;/a/c/f/x/y/z#1?q=2&amp;p=1&#39;</span>
</pre></div>
</div>
<p>generates a url &#8220;/a/c/f&#8221; corresponding to application a, controller c 
and function f. If r=request is passed, a,c,f are set, respectively,
to r.applicaiton, r.controller, r.function.</p>
<p>The more typical usage is:</p>
<p>URL(r=request,f=&#8217;index&#8217;) that generates a url for the index function 
within the present application and controller.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>a</em> &#8211; application (default to current if r is given)</li>
<li><em>c</em> &#8211; controller (default to current if r is given)</li>
<li><em>f</em> &#8211; function (default to current if r is given)</li>
<li><em>r</em> &#8211; request (optional)</li>
<li><em>args</em> &#8211; any arguments (optional)</li>
<li><em>vars</em> &#8211; any variables (optional)</li>
<li><em>anchor</em> &#8211; anchorname, without # (optional)</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises SyntaxError:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">when no application, controller or function is available</p>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises SyntaxError:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">when a CRLF is found in the generated url</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="gluon.html.XML">
<em class="property">
class </em><tt class="descclassname">gluon.html.</tt><tt class="descname">XML</tt><big>(</big><em>text</em>, <em>sanitize=False</em>, <em>permitted_tags=</em><span class="optional">[</span>, <em>'a'</em>, <em>'b'</em>, <em>'blockquote'</em>, <em>'br/'</em>, <em>'i'</em>, <em>'li'</em>, <em>'ol'</em>, <em>'ul'</em>, <em>'p'</em>, <em>'cite'</em>, <em>'code'</em>, <em>'pre'</em>, <em>'img/'</em><span class="optional">]</span>, <em>allowed_attributes={'a':</em><span class="optional">[</span>, <em>'href'</em>, <em>'title'</em><span class="optional">]</span>, <em>'blockquote':</em><span class="optional">[</span>, <em>'type'</em><span class="optional">]</span>, <em>'img':</em><span class="optional">[</span>, <em>'src'</em>, <em>'alt'</em><span class="optional">]</span>, <em>}</em><big>)</big><a class="headerlink" href="#gluon.html.XML" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">gluon.html.XmlComponent</span></tt></p>
<p>use it to wrap a string that contains XML/HTML so that it will not be 
escaped by the template</p>
<p>example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">XML</span><span class="p">(</span><span class="s">&#39;&lt;h1&gt;Hello&lt;/h1&gt;&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">xml</span><span class="p">()</span>
<span class="go">&#39;&lt;h1&gt;Hello&lt;/h1&gt;&#39;</span>
</pre></div>
</div>
<dl class="method">
<dt id="gluon.html.XML.xml">
<tt class="descname">xml</tt><big>(</big><big>)</big><a class="headerlink" href="#gluon.html.XML.xml" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="function">
<dt id="gluon.html.xmlescape">
<tt class="descclassname">gluon.html.</tt><tt class="descname">xmlescape</tt><big>(</big><em>data</em>, <em>quote=False</em><big>)</big><a class="headerlink" href="#gluon.html.xmlescape" title="Permalink to this definition">¶</a></dt>
<dd><p>returns an escaped string of the provided data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>data</em> &#8211; the data to be escaped</li>
<li><em>quote</em> &#8211; optional (default False)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="gluon.html.embed64">
<tt class="descclassname">gluon.html.</tt><tt class="descname">embed64</tt><big>(</big><em>filename=None</em>, <em>file=None</em>, <em>data=None</em>, <em>extension='image/gif'</em><big>)</big><a class="headerlink" href="#gluon.html.embed64" title="Permalink to this definition">¶</a></dt>
<dd><p>helper to encode the provided (binary) data into base64.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>filename</em> &#8211; if provided, opens and reads this file in &#8216;rb&#8217; mode</li>
<li><em>file</em> &#8211; if provided, reads this file</li>
<li><em>data</em> &#8211; if provided, uses the provided data</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="module-gluon.contenttype">
<h2>The <tt class="xref docutils literal"><span class="pre">contenttype</span></tt> Module<a class="headerlink" href="#module-gluon.contenttype" title="Permalink to this headline">¶</a></h2>
<p>This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro &lt;<a class="reference external" href="mailto:mdipierro&#37;&#52;&#48;cs&#46;depaul&#46;edu">mdipierro<span>&#64;</span>cs<span>&#46;</span>depaul<span>&#46;</span>edu</a>&gt;.
License: GPL v2</p>
<dl class="function">
<dt id="gluon.contenttype.contenttype">
<tt class="descclassname">gluon.contenttype.</tt><tt class="descname">contenttype</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#gluon.contenttype.contenttype" title="Permalink to this definition">¶</a></dt>
<dd>Returns the Content-Type string matching extension of the given filename.</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../index.html">
              <img class="logo" src="../_static/logo_colored_small.png" alt="Logo"/>
            </a></p>
            <h3><a href="../index.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="">Gluon Package</a><ul>
<li><a class="reference external" href="#subpackages">Subpackages</a><ul>
</ul>
</li>
<li><a class="reference external" href="#module-gluon.validators">The <tt class="docutils literal"><span class="pre">validators</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.sql">The <tt class="docutils literal"><span class="pre">sql</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.xmlrpc">The <tt class="docutils literal"><span class="pre">xmlrpc</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.shell">The <tt class="docutils literal"><span class="pre">shell</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.utils">The <tt class="docutils literal"><span class="pre">utils</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.globals">The <tt class="docutils literal"><span class="pre">globals</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.compileapp">The <tt class="docutils literal"><span class="pre">compileapp</span></tt> Module</a><ul>
<li><a class="reference external" href="#functions-required-to-execute-app-components">Functions required to execute app components</a></li>
</ul>
</li>
<li><a class="reference external" href="#module-gluon.wsgiserver">The <tt class="docutils literal"><span class="pre">wsgiserver</span></tt> Module</a></li>
<li><a class="reference external" href="#the-winservice-module">The <tt class="docutils literal"><span class="pre">winservice</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.template">The <tt class="docutils literal"><span class="pre">template</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.fileutils">The <tt class="docutils literal"><span class="pre">fileutils</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.sqlhtml">The <tt class="docutils literal"><span class="pre">sqlhtml</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.tools">The <tt class="docutils literal"><span class="pre">tools</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.languages">The <tt class="docutils literal"><span class="pre">languages</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.streamer">The <tt class="docutils literal"><span class="pre">streamer</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.restricted">The <tt class="docutils literal"><span class="pre">restricted</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.http">The <tt class="docutils literal"><span class="pre">http</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.storage">The <tt class="docutils literal"><span class="pre">storage</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.highlight">The <tt class="docutils literal"><span class="pre">highlight</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.cache">The <tt class="docutils literal"><span class="pre">cache</span></tt> Module</a><ul>
<li><a class="reference external" href="#basic-caching-classes-and-methods">Basic caching classes and methods</a></li>
</ul>
</li>
<li><a class="reference external" href="#module-gluon.sanitizer">The <tt class="docutils literal"><span class="pre">sanitizer</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.main">The <tt class="docutils literal"><span class="pre">main</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.widget">The <tt class="docutils literal"><span class="pre">widget</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.rewrite">The <tt class="docutils literal"><span class="pre">rewrite</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.html">The <tt class="docutils literal"><span class="pre">html</span></tt> Module</a></li>
<li><a class="reference external" href="#module-gluon.contenttype">The <tt class="docutils literal"><span class="pre">contenttype</span></tt> Module</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="../modules.html"
                                  title="previous chapter">Web2Py Modules</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="gluon.compat.html"
                                  title="next chapter">Compat Documentation</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="../_sources/gluon/gluon.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="../search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="gluon.compat.html" title="Compat Documentation"
             >next</a> |</li>
        <li class="right" >
          <a href="../modules.html" title="Web2Py Modules"
             >previous</a> |</li>
        <li><a href="../index.html">Web2Py v1.64.4 documentation</a> &raquo;</li>
          <li><a href="../modules.html" >Web2Py Modules</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2009, The web2py developers.
      Last updated on Jun 30, 2009.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.1.
    </div>
  </body>
</html>